Skip to content

Commit

Permalink
* Fixed that webpack-dev-server was having errors and keeping dev-too…
Browse files Browse the repository at this point in the history
…ls from displaying. (the webpack-dev-server module was being double-required for each entry point, and one of them did not have the localhost:PORT __resourceQuery, ie. "?host:port" string set)

* MS path-info comments are included for webpack requires, to help debugging.
  • Loading branch information
Venryx committed Nov 12, 2019
1 parent d141eb3 commit d1fdb0d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
12 changes: 10 additions & 2 deletions scripts/webextension/dev-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ const rootDir = path.join(__dirname, '../../');

require('./prepare');

const HR_PORT = 3001;
const HR_PORT = 5000;

for (const entryName in config.entry) {
if (Object.prototype.hasOwnProperty.call(config.entry, entryName)) {
config.entry[entryName] = [
`webpack-dev-server/client?http://localhost:${HR_PORT}`,
// `webpack-dev-server/client?http://localhost:${HR_PORT}/`,
// 'webpack-dev-server/client', // old; this already gets added automatically by WebpackDevServer below
'webpack/hot/dev-server',
].concat(config.entry[entryName]);
// console.log("Paths:", config.entry[entryName]);
}
}

Expand All @@ -24,6 +26,12 @@ config.plugins = [new webpack.HotModuleReplacementPlugin()].concat(config.plugin
const compiler = webpack(config);

const server = new WebpackDevServer(compiler, {
// host: `http://localhost:${HR_PORT}`,
host: 'localhost',
port: HR_PORT,
disableHostCheck: true,
// sockHost: 'localhost',
// sockPort: HR_PORT,
hot: true,
contentBase: path.join(rootDir, 'lib', TARGET_BROWSER),
headers: { 'Access-Control-Allow-Origin': '*' },
Expand Down
5 changes: 5 additions & 0 deletions src/shells/webextension/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ const rootDir = path.join(__dirname, '../../../');
module.exports = {
mode: "none",
devtool: false,
optimization: {
// use paths as runtime identifiers for webpack modules (easier debugging)
// namedModules: true, // commented; not needed, since "output.pathinfo=true"
},
entry: {
backend: path.join(__dirname, 'backend.js'),
background: path.join(__dirname, 'background.js'),
Expand All @@ -21,6 +25,7 @@ module.exports = {
output: {
path: `${rootDir}/lib/${process.env.TARGET_BROWSER}`,
filename: '[name].js',
pathinfo: true, // include comments next to require-funcs saying path (easier debugging)
},
module: {
rules: [
Expand Down

0 comments on commit d1fdb0d

Please sign in to comment.