aurelia / bootstrapper

Sets up the default configuration for the aurelia framework and gets you up and running quick and easy.
MIT License
75 stars 34 forks source link

refactoring(webpack): opt-out of loader detection #58

Closed jods4 closed 7 years ago

jods4 commented 7 years ago

This code puts global variable AURELIA_WEBPACK_2_0 around the Loader detection code. It changes absolutely nothing for current users as the variable is undefined.

It is a critical piece for the upcoming DllReferencePlugin support in our webpack build. For this to work, I absolutely need aurelia-loader-webpack to be loaded in the main bundle. But what users typically do is put aurelia-bootstrapper and all libs inside a DLL. The Loader detection code was crafted to trigger a webpack dependency on aurelia-loader-webpack and so it ends up in the DLL bundle, which does not work.

To compensate, the new webpack plugins will inject aurelia-loader-webpack themselves into the build at the correct place. This helps webpack DLL work and is simpler for the end user.

I did it this way to not break compatibility with current 1.0 webpack builds. In the future, the Webpack detection code could be completely removed as the 2.0 plugins won't use it.

jods4 commented 7 years ago

@EisenbergEffect I know you're doing a release very soon, can you please merge this in? I need it to add support for webpack DLL. The change is no-op for current users, it's small and trivial.

EisenbergEffect commented 7 years ago

Done :)