@@ -6,22 +6,24 @@ const ConventionDependenciesPlugin_1 = require("./ConventionDependenciesPlugin")
66const DistPlugin_1 = require ( "./DistPlugin" ) ;
77const GlobDependenciesPlugin_1 = require ( "./GlobDependenciesPlugin" ) ;
88const HtmlDependenciesPlugin_1 = require ( "./HtmlDependenciesPlugin" ) ;
9+ const InlineViewDependenciesPlugin_1 = require ( "./InlineViewDependenciesPlugin" ) ;
910const ModuleDependenciesPlugin_1 = require ( "./ModuleDependenciesPlugin" ) ;
1011const PreserveExportsPlugin_1 = require ( "./PreserveExportsPlugin" ) ;
1112const PreserveModuleNamePlugin_1 = require ( "./PreserveModuleNamePlugin" ) ;
1213const SubFolderPlugin_1 = require ( "./SubFolderPlugin" ) ;
1314// See comments inside the module to understand why this is used
14- const emptyEntryModule = "aurelia-webpack-plugin/dist/aurelia -entry" ;
15+ const emptyEntryModule = "aurelia-webpack-plugin/runtime/empty -entry" ;
1516class AureliaPlugin {
1617 constructor ( options = { } ) {
1718 this . options = Object . assign ( {
1819 includeAll : false ,
19- aureliaApp : "main" ,
2020 aureliaConfig : [ "standard" , "developmentLogging" ] ,
2121 dist : "native-modules" ,
2222 features : { } ,
2323 moduleMethods : [ ] ,
2424 noHtmlLoader : false ,
25+ // Undocumented safety switch
26+ noInlineView : false ,
2527 noModulePathResolve : false ,
2628 noWebpackLoader : false ,
2729 // Ideally we would like _not_ to process conventions in node_modules,
@@ -45,6 +47,8 @@ class AureliaPlugin {
4547 const opts = this . options ;
4648 const features = opts . features ;
4749 let needsEmptyEntry = false ;
50+ let dllPlugin = compiler . options . plugins . some ( p => p instanceof webpack_1 . DllPlugin ) ;
51+ let dllRefPlugins = compiler . options . plugins . filter ( p => p instanceof webpack_1 . DllReferencePlugin ) ;
4852 // Make sure the loaders are easy to load at the root like `aurelia-webpack-plugin/html-resource-loader`
4953 let resolveLoader = compiler . options . resolveLoader ;
5054 let alias = resolveLoader . alias || ( resolveLoader . alias = { } ) ;
@@ -57,6 +61,11 @@ class AureliaPlugin {
5761 resolveLoader . symlinks = false ;
5862 compiler . options . resolve . symlinks = false ;
5963 }
64+ // If we aren't building a DLL, "main" is the default entry point
65+ // Note that the 'in' check is because someone may explicitly set aureliaApp to undefined
66+ if ( ! dllPlugin && ! ( "aureliaApp" in opts ) ) {
67+ opts . aureliaApp = "main" ;
68+ }
6069 // Uses DefinePlugin to cut out optional features
6170 const defines = {
6271 AURELIA_WEBPACK_2_0 : "true"
@@ -107,8 +116,6 @@ class AureliaPlugin {
107116 // When using includeAll, we assume it's already included
108117 globalDependencies . push ( { name : opts . aureliaApp , exports : [ "configure" ] } ) ;
109118 }
110- let dllPlugin = compiler . options . plugins . some ( p => p instanceof webpack_1 . DllPlugin ) ;
111- let dllRefPlugins = compiler . options . plugins . filter ( p => p instanceof webpack_1 . DllReferencePlugin ) ;
112119 if ( ! dllPlugin && dllRefPlugins . length > 0 ) {
113120 // Creates delegated entries for all Aurelia modules in DLLs.
114121 // This is required for aurelia-loader-webpack to find them.
@@ -122,10 +129,7 @@ class AureliaPlugin {
122129 }
123130 if ( ! dllPlugin && ! opts . noWebpackLoader ) {
124131 // Setup aurelia-loader-webpack as the module loader
125- // Note that code inside aurelia-loader-webpack performs PLATFORM.Loader = WebpackLoader;
126- // Since this runs very early, before any other Aurelia code, we need "aurelia-polyfills"
127- // for older platforms (e.g. `Map` is undefined in IE 10-).
128- this . addEntry ( compiler . options , [ "aurelia-polyfills" , "aurelia-loader-webpack" ] ) ;
132+ this . addEntry ( compiler . options , [ "aurelia-webpack-plugin/runtime/pal-loader-entry" ] ) ;
129133 }
130134 if ( ! opts . noHtmlLoader ) {
131135 // Ensure that we trace HTML dependencies (always required because of 3rd party libs)
@@ -135,6 +139,9 @@ class AureliaPlugin {
135139 // because it will process the file first, before any other loader.
136140 rules . push ( { test : / \. h t m l ? $ / i, use : "aurelia-webpack-plugin/html-requires-loader" } ) ;
137141 }
142+ if ( ! opts . noInlineView ) {
143+ compiler . apply ( new InlineViewDependenciesPlugin_1 . InlineViewDependenciesPlugin ( ) ) ;
144+ }
138145 if ( globalDependencies . length > 0 ) {
139146 dependencies [ emptyEntryModule ] = globalDependencies ;
140147 needsEmptyEntry = true ;
@@ -186,6 +193,7 @@ function getPAL(target) {
186193 switch ( target ) {
187194 case "web" : return "aurelia-pal-browser" ;
188195 case "webworker" : return "aurelia-pal-worker" ;
196+ case "electron-renderer" : return "aurelia-pal-browser" ;
189197 default : return "aurelia-pal-nodejs" ;
190198 }
191199}
0 commit comments