@@ -3,11 +3,13 @@ const { join, relative, resolve, sep } = require("path");
3
3
const webpack = require ( "webpack" ) ;
4
4
const nsWebpack = require ( "nativescript-dev-webpack" ) ;
5
5
const nativescriptTarget = require ( "nativescript-dev-webpack/nativescript-target" ) ;
6
+ const { PlatformReplacementHost } = require ( "nativescript-dev-webpack/host/platform" ) ;
6
7
const CleanWebpackPlugin = require ( "clean-webpack-plugin" ) ;
7
8
const CopyWebpackPlugin = require ( "copy-webpack-plugin" ) ;
8
9
const { BundleAnalyzerPlugin } = require ( "webpack-bundle-analyzer" ) ;
9
10
const { NativeScriptWorkerPlugin } = require ( "nativescript-worker-loader/NativeScriptWorkerPlugin" ) ;
10
11
const UglifyJsPlugin = require ( "uglifyjs-webpack-plugin" ) ;
12
+ const { AngularCompilerPlugin } = require ( "@ngtools/webpack" ) ;
11
13
12
14
module . exports = env => {
13
15
// Add your custom Activities, Services and other Android app components here.
@@ -22,9 +24,10 @@ module.exports = env => {
22
24
throw new Error ( "You need to provide a target platform!" ) ;
23
25
}
24
26
25
- const platforms = [ "ios" , "android" ] ;
27
+ const extensions = [ "tns" , platform ] ;
28
+ const platformHost = new PlatformReplacementHost ( extensions ) ;
29
+
26
30
const projectRoot = __dirname ;
27
- nsWebpack . loadAdditionalPlugins ( { projectDir : projectRoot } ) ;
28
31
29
32
// Default destination inside platforms/<platform>/...
30
33
const dist = resolve ( projectRoot , nsWebpack . getAppPath ( platform , projectRoot ) ) ;
@@ -147,7 +150,7 @@ module.exports = env => {
147
150
{
148
151
loader : "nativescript-dev-webpack/bundle-config-loader" ,
149
152
options : {
150
- registerPages : false ,
153
+ angular : true ,
151
154
loadCss : ! snapshot , // load the application css if in debug mode
152
155
}
153
156
} ,
@@ -221,15 +224,12 @@ module.exports = env => {
221
224
// For instructions on how to set up workers with webpack
222
225
// check out https://github.com/nativescript/worker-loader
223
226
new NativeScriptWorkerPlugin ( ) ,
224
- // AngularCompilerPlugin with augmented NativeScript filesystem to handle platform specific resource resolution.
225
- new nsWebpack . NativeScriptAngularCompilerPlugin ( {
227
+
228
+ new AngularCompilerPlugin ( {
229
+ host : platformHost ,
226
230
entryModule : resolve ( appPath , "app.module#AppModule" ) ,
227
231
tsConfigPath : join ( __dirname , "tsconfig.esm.json" ) ,
228
232
skipCodeGeneration : ! aot ,
229
- platformOptions : {
230
- platform,
231
- platforms,
232
- } ,
233
233
} ) ,
234
234
// Does IPC communication with the {N} CLI to notify events when running in watch mode.
235
235
new nsWebpack . WatchStateLoggerPlugin ( ) ,
@@ -250,6 +250,7 @@ module.exports = env => {
250
250
if ( snapshot ) {
251
251
config . plugins . push ( new nsWebpack . NativeScriptSnapshotPlugin ( {
252
252
chunk : "vendor" ,
253
+ angular : true ,
253
254
requireModules : [
254
255
"reflect-metadata" ,
255
256
"@angular/platform-browser" ,
0 commit comments