问题
I'm trying to wrap my head around the starter kit skeleton-esnext-webpack
and the way the Aurelia team has set up the webpack.config.babel.js
Now that I have somehow understood how to configure a basic project in Aurelia, before I go any further, what I want to know is whether it is possible to configure more than one app (aurelia-app
) using Webpack and how?
The "Quick Start" guide gave the impression that it is possible by creating more than one js file, each of which should export a configure
method specifying the root component (setRoot
). This seemed sort of easy in the "Quick Start" guide, but as it is mentioned it is not optimal for real-world projects, so I need to configure two or more root components using Webpack, the problem is that with all the @easy-webpack stuff thrown everywhere in the configuration file, I honestly don't know where to make the changes.
In the webpack.config.babel.js
file I can see they're using a 'multiple-entry-point' configuration
let config = generateConfig(
{
entry: {
'app': ['./src/main' /* this is filled by the aurelia-webpack-plugin */],
'aurelia-bootstrap': coreBundles.bootstrap,
'aurelia': coreBundles.aurelia.filter(pkg => coreBundles.bootstrap.indexOf(pkg) === -1)
},
output: {
path: outDir
}
},
And then, this is how they use something similar to the CommonsChunkPlugin
commonChunksOptimize({appChunkName: 'app', firstChunk: 'aurelia-bootstrap'}),
But where is the [name]
entry specified? In fact, where's the appChunckName being specified?
I've been using Webpack for less than a week, I think that it would've been much better to use a "standard" webpack configuration than to use @easy-webpack. Seriously the framework looks great, but just getting started can get really frustrating if you want to use a "standard" configuration.
来源:https://stackoverflow.com/questions/40978120/how-can-i-configure-two-or-more-apps-in-aurelia-using-webpack