Skip to content

Commit

Permalink
fix: Webpack dev server infinite loop (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
igdev0 authored Mar 23, 2023
1 parent 9ca0ad3 commit 94eb991
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 0 additions & 1 deletion demos/browser/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {BasicMessage} from "../../prism-agent/protocols/other/BasicMessage";
const mediatorDID = SDK.Domain.DID.fromString(
"did:peer:2.Ez6LScuuNiWo8rwnpYy5dXbq7JnVDv6yCgsAz6viRUWCUbCJk.Vz6MkfzL1tPPvpXioYDwuGQRdpATV1qb4x7mKmcXyhCmLcUGK.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOiJodHRwczovL21lZGlhdG9yLmpyaWJvLmtpd2kiLCJhIjpbImRpZGNvbW0vdjIiXX0"
);

const apollo = new SDK.Apollo();
const castor = new SDK.Castor(apollo);
const api = new SDK.ApiImpl();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"postinstall": "./scripts/typeorm-cleanup.sh",
"build:browser": "webpack --mode=production --config webpack/webpack.browser.conf.js",
"build:node": "webpack --mode=production --config webpack/webpack.node.conf.js",
"dev:browser": "rm -rf build && npm run types && webpack serve --mode=development --config webpack/webpack.browser.conf.js",
"dev:browser": "webpack serve --mode=development --config webpack/webpack.browser.conf.js",
"dev:node": "rm -rf build && npm run types && webpack --watch --mode=development --config webpack/webpack.node.conf.js",
"test": "jest",
"coverage": "npm run test -- --coverage",
Expand Down
12 changes: 9 additions & 3 deletions webpack/webpack.browser.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = (env, argv) => {
<head>
<meta charset="utf-8">
<title>Webpack test</title>
<meta name="viewport" content="width=device-width, initial-scale=1"><script defer src="index.js"></script></head>
<meta name="viewport" content="width=device-width, initial-scale=1"></head>
<body>
<div id="root"></div>
</body>
Expand All @@ -58,6 +58,13 @@ module.exports = (env, argv) => {
minimizer.push(new TerserPlugin({extractComments: true, terserOptions: {mangle: false}}));
}

const conditionalOutputProps = isProduction ? {
chunkFormat: "commonjs",
filename: "index.js",
} : {
filename: "[hash].module.js"
}

return {
target: "web",
mode: isProduction ? "production" : "development",
Expand All @@ -76,7 +83,7 @@ module.exports = (env, argv) => {
port: 9000,
},
output: {
filename: "index.js",
...conditionalOutputProps,
libraryTarget: "umd",
library: "prism",
path: path.resolve(
Expand All @@ -85,7 +92,6 @@ module.exports = (env, argv) => {
),
publicPath: "/",
webassemblyModuleFilename: "index_bg.module.wasm",
chunkFormat: "commonjs",
},
optimization: {
// splitChunks: {
Expand Down

0 comments on commit 94eb991

Please sign in to comment.