webpack serve
This commit is contained in:
parent
5f09109ad7
commit
f1acb9fe99
5
makefile
5
makefile
@ -1,5 +1,8 @@
|
|||||||
build:
|
build:
|
||||||
npx webpack --mode production
|
npx webpack
|
||||||
|
|
||||||
|
serve:
|
||||||
|
npx webpack serve --no-open
|
||||||
|
|
||||||
dev-server:
|
dev-server:
|
||||||
python -m http.server --directory dist/ 8700
|
python -m http.server --directory dist/ 8700
|
||||||
|
3382
package-lock.json
generated
3382
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -16,6 +16,7 @@
|
|||||||
"sass-loader": "^13.2.0",
|
"sass-loader": "^13.2.0",
|
||||||
"style-loader": "^3.3.1",
|
"style-loader": "^3.3.1",
|
||||||
"webpack": "^5.75.0",
|
"webpack": "^5.75.0",
|
||||||
"webpack-cli": "^5.0.1"
|
"webpack-cli": "^5.0.1",
|
||||||
|
"webpack-dev-server": "^4.11.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,38 @@
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
|
|
||||||
|
function relpath(fp) {
|
||||||
|
return path.resolve(__dirname, ...fp.split('/'));
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
mode: 'production',
|
||||||
entry: {
|
entry: {
|
||||||
index: path.resolve(__dirname, 'src', 'index.js'),
|
index: relpath('src/index.js'),
|
||||||
},
|
},
|
||||||
devtool: 'inline-source-map',
|
devtool: 'inline-source-map',
|
||||||
plugins: [
|
plugins: [
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
title: 'Example Webapp',
|
title: 'Example Webapp',
|
||||||
template: path.resolve(__dirname, 'src', 'index.html'),
|
template: relpath('src/index.html'),
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
output: {
|
output: {
|
||||||
clean: true,
|
clean: true,
|
||||||
filename: '[name].bundle.js',
|
filename: '[name].bundle.js',
|
||||||
path: path.resolve(__dirname, 'dist'),
|
path: relpath('dist'),
|
||||||
|
},
|
||||||
|
devServer: {
|
||||||
|
static: relpath('dist'),
|
||||||
|
},
|
||||||
|
optimization: {
|
||||||
|
// fixes problems when bundling more than one entry
|
||||||
|
runtimeChunk: 'single',
|
||||||
|
},
|
||||||
|
performance: {
|
||||||
|
// hides the performance warnings for now
|
||||||
|
// TODO: proper code splitting
|
||||||
|
hints: false,
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
|
Loading…
Reference in New Issue
Block a user