@@ -7,7 +7,7 @@ const { nsReplaceBootstrap } = require("nativescript-dev-webpack/transformers/ns
7
7
const { nsReplaceLazyLoader } = require ( "nativescript-dev-webpack/transformers/ns-replace-lazy-loader" ) ;
8
8
const { nsSupportHmrNg } = require ( "nativescript-dev-webpack/transformers/ns-support-hmr-ng" ) ;
9
9
const { getMainModulePath } = require ( "nativescript-dev-webpack/utils/ast-utils" ) ;
10
- const { getNoEmitOnErrorFromTSConfig } = require ( "nativescript-dev-webpack/utils/tsconfig-utils" ) ;
10
+ const { getNoEmitOnErrorFromTSConfig, getCompilerOptionsFromTSConfig } = require ( "nativescript-dev-webpack/utils/tsconfig-utils" ) ;
11
11
const CleanWebpackPlugin = require ( "clean-webpack-plugin" ) ;
12
12
const CopyWebpackPlugin = require ( "copy-webpack-plugin" ) ;
13
13
const { BundleAnalyzerPlugin } = require ( "webpack-bundle-analyzer" ) ;
@@ -60,19 +60,28 @@ module.exports = env => {
60
60
const isAnySourceMapEnabled = ! ! sourceMap || ! ! hiddenSourceMap ;
61
61
const externals = nsWebpack . getConvertedExternals ( env . externals ) ;
62
62
const appFullPath = resolve ( projectRoot , appPath ) ;
63
+ const tsConfigName = "tsconfig.tns.json" ;
64
+ const tsConfigPath = join ( __dirname , tsConfigName ) ;
63
65
const hasRootLevelScopedModules = nsWebpack . hasRootLevelScopedModules ( { projectDir : projectRoot } ) ;
66
+ const hasRootLevelScopedAngular = nsWebpack . hasRootLevelScopedAngular ( { projectDir : projectRoot } ) ;
64
67
let coreModulesPackageName = "tns-core-modules" ;
65
68
const alias = {
66
69
'~' : appFullPath
67
70
} ;
68
71
72
+ const compilerOptions = getCompilerOptionsFromTSConfig ( tsConfigPath ) ;
69
73
if ( hasRootLevelScopedModules ) {
70
74
coreModulesPackageName = "@nativescript/core" ;
71
75
alias [ "tns-core-modules" ] = coreModulesPackageName ;
76
+ nsWebpack . processTsPathsForScopedModules ( { compilerOptions } ) ;
77
+ }
78
+
79
+ if ( hasRootLevelScopedAngular ) {
72
80
alias [ "nativescript-angular" ] = "@nativescript/angular" ;
81
+ nsWebpack . processTsPathsForScopedAngular ( { compilerOptions } ) ;
73
82
}
83
+
74
84
const appResourcesFullPath = resolve ( projectRoot , appResourcesPath ) ;
75
- const tsConfigName = "tsconfig.tns.json" ;
76
85
const entryModule = `${ nsWebpack . getEntryModule ( appFullPath , platform ) } .ts` ;
77
86
const entryPath = `.${ sep } ${ entryModule } ` ;
78
87
const entries = { bundle : entryPath } ;
@@ -109,10 +118,11 @@ module.exports = env => {
109
118
hostReplacementPaths : nsWebpack . getResolver ( [ platform , "tns" ] ) ,
110
119
platformTransformers : ngCompilerTransformers . map ( t => t ( ( ) => ngCompilerPlugin , resolve ( appFullPath , entryModule ) , projectRoot ) ) ,
111
120
mainPath : join ( appFullPath , entryModule ) ,
112
- tsConfigPath : join ( __dirname , tsConfigName ) ,
121
+ tsConfigPath,
113
122
skipCodeGeneration : ! aot ,
114
123
sourceMap : ! ! isAnySourceMapEnabled ,
115
- additionalLazyModuleResources : additionalLazyModuleResources
124
+ additionalLazyModuleResources : additionalLazyModuleResources ,
125
+ compilerOptions : { paths : compilerOptions . paths }
116
126
} ) ;
117
127
118
128
let sourceMapFilename = nsWebpack . getSourceMapFilename ( hiddenSourceMap , __dirname , dist ) ;
0 commit comments