Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit 2fe4928

Browse files
committed
chore: update the webpack.config of the demo app
1 parent b74b231 commit 2fe4928

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

Diff for: demo/AngularApp/webpack.config.js

+14-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const { nsReplaceBootstrap } = require("nativescript-dev-webpack/transformers/ns
77
const { nsReplaceLazyLoader } = require("nativescript-dev-webpack/transformers/ns-replace-lazy-loader");
88
const { nsSupportHmrNg } = require("nativescript-dev-webpack/transformers/ns-support-hmr-ng");
99
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");
1111
const CleanWebpackPlugin = require("clean-webpack-plugin");
1212
const CopyWebpackPlugin = require("copy-webpack-plugin");
1313
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
@@ -61,19 +61,28 @@ module.exports = env => {
6161
const isAnySourceMapEnabled = !!sourceMap || !!hiddenSourceMap;
6262
const externals = nsWebpack.getConvertedExternals(env.externals);
6363
const appFullPath = resolve(projectRoot, appPath);
64+
const tsConfigName = "tsconfig.tns.json";
65+
const tsConfigPath = join(__dirname, tsConfigName);
6466
const hasRootLevelScopedModules = nsWebpack.hasRootLevelScopedModules({ projectDir: projectRoot });
67+
const hasRootLevelScopedAngular = nsWebpack.hasRootLevelScopedAngular({ projectDir: projectRoot });
6568
let coreModulesPackageName = "tns-core-modules";
6669
const alias = {
6770
'~': appFullPath
6871
};
6972

73+
const compilerOptions = getCompilerOptionsFromTSConfig(tsConfigPath);
7074
if (hasRootLevelScopedModules) {
7175
coreModulesPackageName = "@nativescript/core";
7276
alias["tns-core-modules"] = coreModulesPackageName;
77+
nsWebpack.processTsPathsForScopedModules({ compilerOptions });
78+
}
79+
80+
if (hasRootLevelScopedAngular) {
7381
alias["nativescript-angular"] = "@nativescript/angular";
82+
nsWebpack.processTsPathsForScopedAngular({ compilerOptions });
7483
}
84+
7585
const appResourcesFullPath = resolve(projectRoot, appResourcesPath);
76-
const tsConfigName = "tsconfig.tns.json";
7786
const entryModule = `${nsWebpack.getEntryModule(appFullPath, platform)}.ts`;
7887
const entryPath = `.${sep}${entryModule}`;
7988
const entries = { bundle: entryPath, application: "./application.android" };
@@ -110,10 +119,11 @@ module.exports = env => {
110119
hostReplacementPaths: nsWebpack.getResolver([platform, "tns"]),
111120
platformTransformers: ngCompilerTransformers.map(t => t(() => ngCompilerPlugin, resolve(appFullPath, entryModule), projectRoot)),
112121
mainPath: join(appFullPath, entryModule),
113-
tsConfigPath: join(__dirname, tsConfigName),
122+
tsConfigPath,
114123
skipCodeGeneration: !aot,
115124
sourceMap: !!isAnySourceMapEnabled,
116-
additionalLazyModuleResources: additionalLazyModuleResources
125+
additionalLazyModuleResources: additionalLazyModuleResources,
126+
compilerOptions: { paths: compilerOptions.paths }
117127
});
118128

119129
let sourceMapFilename = nsWebpack.getSourceMapFilename(hiddenSourceMap, __dirname, dist);

0 commit comments

Comments
 (0)