Adjust webpack config slightly for better generation.

This commit is contained in:
projectmoon 2021-01-09 13:32:08 +00:00
parent a34e8d24c6
commit ee892a3f34
3 changed files with 9 additions and 4 deletions

View File

@ -5,7 +5,7 @@
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"webpack-dev": "webpack serve --watch --inline --port 8081 --host 0.0.0.0 --output-path=./build",
"webpack-dev": "webpack --watch",
"build:protobuf": "mkdir -p src/frontend/_proto && protoc --plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts -I ./proto --js_out=import_style=commonjs,binary:./src/frontend/_proto --ts_out=service=grpc-web:./src/frontend/_proto ./proto/*.proto",
"build:webpack": "webpack"
},

View File

@ -5,6 +5,7 @@ import * as api from "../api";
// changes to the server as the user makes them.
(async () => {
// Useful for making sure elements actually exist in event handler.
type Option<T> = T | null | undefined;
const [, , USERNAME, CHARACTER_ID] = window.location.pathname.split('/');

View File

@ -31,8 +31,8 @@ module.exports = {
},
mode: "development",
output: {
path: `${root}/generated/scripts/dist`,
filename: '[name].bundle.js'
path: `${root}/generated`,
filename: 'scripts/dist/[name].bundle.js'
},
devtool: 'inline-source-map',
module: {
@ -49,7 +49,11 @@ module.exports = {
extensions: [".ts", ".js"]
},
plugins: [
new CleanWebpackPlugin(),
new CleanWebpackPlugin({
cleanOnceBeforeBuildPatterns: ['!templates/**/*'],
cleanAfterEveryBuildPatterns: ['!templates/**/*'],
dry: false
}),
packPage('login.html.tera'),
packPage('base.html.tera'),
packPage('error.html.tera'),