How can I configure two or more apps in Aurelia using Webpack

我们两清 提交于 2019-11-28 08:50:31

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!