-
-
Notifications
You must be signed in to change notification settings - Fork 133
Description
I'm submitting a bug report
Current behavior:
Looking at the structure of a CLI generated project based on webpack, the webpack dev server client is added in both the index.ejs file and also in 'aurelia_project/tasks/run.ts' when HMR is used.
index.ejs contains this:
<% if (htmlWebpackPlugin.options.metadata.server) { %>
<!-- Webpack Dev Server reload -->
<script src="https://github.com/webpack-dev-server.js"></script>
<% } %>
run.ts contains this:
if (project.platform.hmr || CLIOptions.hasFlag('hmr')) {
config.plugins.push(new webpack.HotModuleReplacementPlugin());
config.entry.app.unshift(`webpack-dev-server/client?http://${opts.host}:${opts.port}/`, 'webpack/hot/dev-server');
}
As a result of this, when HMR mode is used, the script entry in index.ejs becomes redundant.
The script entry should be removed from index.ejs and run.ts should be changed to this:
if (project.platform.hmr || CLIOptions.hasFlag('hmr')) {
config.plugins.push(new webpack.HotModuleReplacementPlugin());
config.entry.app.unshift(`webpack-dev-server/client?http://${opts.host}:${opts.port}/`, 'webpack/hot/dev-server');
} else {
config.entry.app.unshift(`webpack-dev-server/client?http://${opts.host}:${opts.port}/`);
}
This does not seem to cause a problem out of the box, but when attempting to run Aurelia from a subpath off the root, the redundant script entry produces an unnecessary complication.
-
What is the expected behavior?
The generated config to be more consistent -
What is the motivation / use case for changing the behavior?
Provide a better development experience for more advanced scenarios