Snippet from node_modules\aurelia-webpack-plugin\dist\AureliaPlugin.js
addEntry(options, modules) {
let webpackEntry = options.entry;
let entries = Array.isArray(modules) ? modules : [modules];
if (typeof webpackEntry == "object" && !Array.isArray(webpackEntry)) {
// There are multiple entries defined in the config
// Unless there was a particular configuration, we modify the first one
// (note that JS enumerates props in the same order they were declared)
// Modifying the first one only plays nice with the common pattern
// `entry: { main, vendor }` some people use.
let ks = this.options.entry || Object.keys(webpackEntry)[0];
if (!Array.isArray(ks)) {
ks = [ks];
}
ks.forEach(k => {
webpackEntry[k] = entries.concat(webpackEntry[k])
});
} else {
options.entry = entries.concat(webpackEntry);
}
}
What is the motivation / use case for changing the behavior?
Before Webpack 4, the fix/workaround above probably made sense. However, since vendoring is not handled in entry anymore, I think we can remove this without much fuss. I think ultimately it would help Aurelia be more predictable.
Making this change would require a major version bump as it breaks / changes behaviour.
addEntry(options, modules) {
let webpackEntry = options.entry;
let entries = Array.isArray(modules) ? modules : [modules];
if (typeof webpackEntry == "object" && !Array.isArray(webpackEntry)) {
for (let k in webpackEntry) {
if (!webpackEntry.hasOwnProperty(k)) {
continue;
}
let entry = webpackEntry[k];
if (!Array.isArray(entry)) {
entry = [entry];
}
webpackEntry[k] = entries.concat(entry)
}
} else {
options.entry = entries.concat(webpackEntry);
}
}
I'm submitting a bug report
Please tell us about your environment:
Current behavior: Aurelia currently only prepends special runtime files to the first
entry
defined in your Webpack config file.Snippet from
node_modules\aurelia-webpack-plugin\dist\AureliaPlugin.js
Before Webpack 4, the fix/workaround above probably made sense. However, since vendoring is not handled in
entry
anymore, I think we can remove this without much fuss. I think ultimately it would help Aurelia be more predictable.Making this change would require a major version bump as it breaks / changes behaviour.