@nativescript/webpack 4.0.1 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,338 +1,332 @@
1
- const { join, relative, resolve, sep } = require("path");
1
+ const { join, relative, resolve, sep } = require('path');
2
2
  const fs = require('fs');
3
3
 
4
- const webpack = require("webpack");
5
- const nsWebpack = require("@nativescript/webpack");
6
- const nativescriptTarget = require("@nativescript/webpack/nativescript-target");
7
- const { getNoEmitOnErrorFromTSConfig } = require("@nativescript/webpack/utils/tsconfig-utils");
8
- const { CleanWebpackPlugin } = require("clean-webpack-plugin");
9
- const CopyWebpackPlugin = require("copy-webpack-plugin");
4
+ const webpack = require('webpack');
5
+ const nsWebpack = require('@nativescript/webpack');
6
+ const nativescriptTarget = require('@nativescript/webpack/nativescript-target');
7
+ const { getNoEmitOnErrorFromTSConfig } = require('@nativescript/webpack/utils/tsconfig-utils');
8
+ const { CleanWebpackPlugin } = require('clean-webpack-plugin');
9
+ const CopyWebpackPlugin = require('copy-webpack-plugin');
10
10
  const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
11
- const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
12
- const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeScriptWorkerPlugin");
13
- const TerserPlugin = require("terser-webpack-plugin");
11
+ const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
12
+ const { NativeScriptWorkerPlugin } = require('nativescript-worker-loader/NativeScriptWorkerPlugin');
13
+ const TerserPlugin = require('terser-webpack-plugin');
14
14
  const hashSalt = Date.now().toString();
15
15
 
16
- module.exports = env => {
17
- // Add your custom Activities, Services and other Android app components here.
18
- const appComponents = env.appComponents || [];
19
- appComponents.push(...[
20
- "@nativescript/core/ui/frame",
21
- "@nativescript/core/ui/frame/activity",
22
- ]);
16
+ module.exports = (env) => {
17
+ const platform = env && ((env.android && 'android') || (env.ios && 'ios') || env.platform);
18
+ if (!platform) {
19
+ throw new Error('You need to provide a target platform!');
20
+ }
23
21
 
24
- const platform = env && (env.android && "android" || env.ios && "ios" || env.platform);
25
- if (!platform) {
26
- throw new Error("You need to provide a target platform!");
27
- }
22
+ const platforms = ['ios', 'android'];
23
+ const projectRoot = __dirname;
28
24
 
29
- const platforms = ["ios", "android"];
30
- const projectRoot = __dirname;
25
+ if (env.platform) {
26
+ platforms.push(env.platform);
27
+ }
31
28
 
32
- if (env.platform) {
33
- platforms.push(env.platform);
34
- }
29
+ // Default destination inside platforms/<platform>/...
30
+ const dist = resolve(projectRoot, nsWebpack.getAppPath(platform, projectRoot));
35
31
 
36
- // Default destination inside platforms/<platform>/...
37
- const dist = resolve(projectRoot, nsWebpack.getAppPath(platform, projectRoot));
32
+ const {
33
+ // The 'appPath' and 'appResourcesPath' values are fetched from
34
+ // the nsconfig.json configuration file.
35
+ appPath = 'src',
36
+ appResourcesPath = 'App_Resources',
38
37
 
39
- const {
40
- // The 'appPath' and 'appResourcesPath' values are fetched from
41
- // the nsconfig.json configuration file.
42
- appPath = "src",
43
- appResourcesPath = "App_Resources",
38
+ // You can provide the following flags when running 'tns run android|ios'
39
+ snapshot, // --env.snapshot
40
+ production, // --env.production
41
+ uglify, // --env.uglify
42
+ report, // --env.report
43
+ sourceMap, // --env.sourceMap
44
+ hiddenSourceMap, // --env.hiddenSourceMap
45
+ hmr, // --env.hmr,
46
+ unitTesting, // --env.unitTesting,
47
+ testing, // --env.testing
48
+ verbose, // --env.verbose
49
+ ci, // --env.ci
50
+ snapshotInDocker, // --env.snapshotInDocker
51
+ skipSnapshotTools, // --env.skipSnapshotTools
52
+ compileSnapshot, // --env.compileSnapshot
53
+ appComponents = [],
54
+ entries = {},
55
+ } = env;
44
56
 
45
- // You can provide the following flags when running 'tns run android|ios'
46
- snapshot, // --env.snapshot
47
- production, // --env.production
48
- uglify, // --env.uglify
49
- report, // --env.report
50
- sourceMap, // --env.sourceMap
51
- hiddenSourceMap, // --env.hiddenSourceMap
52
- hmr, // --env.hmr,
53
- unitTesting, // --env.unitTesting,
54
- testing, // --env.testing
55
- verbose, // --env.verbose
56
- snapshotInDocker, // --env.snapshotInDocker
57
- skipSnapshotTools, // --env.skipSnapshotTools
58
- compileSnapshot // --env.compileSnapshot
59
- } = env;
57
+ const useLibs = compileSnapshot;
58
+ const isAnySourceMapEnabled = !!sourceMap || !!hiddenSourceMap;
59
+ const externals = nsWebpack.getConvertedExternals(env.externals);
60
60
 
61
- const useLibs = compileSnapshot;
62
- const isAnySourceMapEnabled = !!sourceMap || !!hiddenSourceMap;
63
- const externals = nsWebpack.getConvertedExternals(env.externals);
61
+ let appFullPath = resolve(projectRoot, appPath);
62
+ if (!fs.existsSync(appFullPath)) {
63
+ // some apps use 'app' directory
64
+ appFullPath = resolve(projectRoot, 'app');
65
+ }
66
+ const hasRootLevelScopedModules = nsWebpack.hasRootLevelScopedModules({ projectDir: projectRoot });
67
+ let coreModulesPackageName = 'tns-core-modules';
68
+ const alias = env.alias || {};
69
+ alias['~/package.json'] = resolve(projectRoot, 'package.json');
70
+ alias['~'] = appFullPath;
64
71
 
65
- let appFullPath = resolve(projectRoot, appPath);
66
- if (!fs.existsSync(appFullPath)) {
67
- // some apps use 'app' directory
68
- appFullPath = resolve(projectRoot, 'app');
69
- }
70
- const hasRootLevelScopedModules = nsWebpack.hasRootLevelScopedModules({ projectDir: projectRoot });
71
- let coreModulesPackageName = "tns-core-modules";
72
- const alias = env.alias || {};
73
- alias['~/package.json'] = resolve(projectRoot, 'package.json');
74
- alias['~'] = appFullPath;
72
+ if (hasRootLevelScopedModules) {
73
+ coreModulesPackageName = '@nativescript/core';
74
+ alias['tns-core-modules'] = coreModulesPackageName;
75
+ }
76
+ const appResourcesFullPath = resolve(projectRoot, appResourcesPath);
75
77
 
76
- if (hasRootLevelScopedModules) {
77
- coreModulesPackageName = "@nativescript/core";
78
- alias["tns-core-modules"] = coreModulesPackageName;
79
- }
80
- const appResourcesFullPath = resolve(projectRoot, appResourcesPath);
78
+ const copyIgnore = { ignore: [`${relative(appPath, appResourcesFullPath)}/**`] };
81
79
 
82
- const copyIgnore = { ignore: [`${relative(appPath, appResourcesFullPath)}/**`] };
80
+ const entryModule = nsWebpack.getEntryModule(appFullPath, platform);
81
+ const entryPath = `.${sep}${entryModule}.ts`;
82
+ Object.assign(entries, { bundle: entryPath }, entries);
83
83
 
84
- const entryModule = nsWebpack.getEntryModule(appFullPath, platform);
85
- const entryPath = `.${sep}${entryModule}.ts`;
86
- const entries = env.entries || {};
87
- entries.bundle = entryPath;
84
+ const tsConfigPath = resolve(projectRoot, 'tsconfig.json');
88
85
 
89
- const tsConfigPath = resolve(projectRoot, "tsconfig.json");
86
+ const areCoreModulesExternal = Array.isArray(env.externals) && env.externals.some((e) => e.indexOf('@nativescript') > -1);
87
+ if (platform === 'ios' && !areCoreModulesExternal && !testing) {
88
+ entries['tns_modules/inspector_modules'] = '@nativescript/core/inspector_modules';
89
+ }
90
90
 
91
- const areCoreModulesExternal = Array.isArray(env.externals) && env.externals.some(e => e.indexOf("@nativescript") > -1);
92
- if (platform === "ios" && !areCoreModulesExternal && !testing) {
93
- entries["tns_modules/@nativescript/core/inspector_modules"] = "inspector_modules";
94
- };
91
+ let sourceMapFilename = nsWebpack.getSourceMapFilename(hiddenSourceMap, __dirname, dist);
95
92
 
96
- let sourceMapFilename = nsWebpack.getSourceMapFilename(hiddenSourceMap, __dirname, dist);
93
+ const itemsToClean = [`${dist}/**/*`];
94
+ if (platform === 'android') {
95
+ itemsToClean.push(`${join(projectRoot, 'platforms', 'android', 'app', 'src', 'main', 'assets', 'snapshots')}`);
96
+ itemsToClean.push(`${join(projectRoot, 'platforms', 'android', 'app', 'build', 'configurations', 'nativescript-android-snapshot')}`);
97
+ }
97
98
 
98
- const itemsToClean = [`${dist}/**/*`];
99
- if (platform === "android") {
100
- itemsToClean.push(`${join(projectRoot, "platforms", "android", "app", "src", "main", "assets", "snapshots")}`);
101
- itemsToClean.push(`${join(projectRoot, "platforms", "android", "app", "build", "configurations", "nativescript-android-snapshot")}`);
102
- }
99
+ const noEmitOnErrorFromTSConfig = getNoEmitOnErrorFromTSConfig(tsConfigPath);
103
100
 
104
- const noEmitOnErrorFromTSConfig = getNoEmitOnErrorFromTSConfig(tsConfigPath);
101
+ // Add your custom Activities, Services and other android app components here.
102
+ appComponents.push('@nativescript/core/ui/frame', '@nativescript/core/ui/frame/activity');
105
103
 
106
- nsWebpack.processAppComponents(appComponents, platform);
107
- const config = {
108
- mode: production ? "production" : "development",
109
- context: appFullPath,
110
- externals,
111
- watchOptions: {
112
- ignored: [
113
- appResourcesFullPath,
114
- // Don't watch hidden files
115
- "**/.*",
116
- ]
117
- },
118
- target: nativescriptTarget,
119
- entry: entries,
120
- output: {
121
- pathinfo: false,
122
- path: dist,
123
- sourceMapFilename,
124
- libraryTarget: "commonjs2",
125
- filename: "[name].js",
126
- globalObject: "global",
127
- hashSalt
128
- },
129
- resolve: {
130
- extensions: [".ts", ".js", ".scss", ".css"],
131
- // Resolve {N} system modules from @nativescript/core
132
- modules: [
133
- resolve(__dirname, `node_modules/${coreModulesPackageName}`),
134
- resolve(__dirname, "node_modules"),
135
- `node_modules/${coreModulesPackageName}`,
136
- "node_modules",
137
- ],
138
- alias,
139
- // resolve symlinks to symlinked modules
140
- symlinks: true
141
- },
142
- resolveLoader: {
143
- // don't resolve symlinks to symlinked loaders
144
- symlinks: false
145
- },
146
- node: {
147
- // Disable node shims that conflict with NativeScript
148
- "http": false,
149
- "timers": false,
150
- "setImmediate": false,
151
- "fs": "empty",
152
- "__dirname": false,
153
- },
154
- devtool: hiddenSourceMap ? "hidden-source-map" : (sourceMap ? "inline-source-map" : "none"),
155
- optimization: {
156
- runtimeChunk: "single",
157
- noEmitOnErrors: noEmitOnErrorFromTSConfig,
158
- splitChunks: {
159
- cacheGroups: {
160
- vendor: {
161
- name: "vendor",
162
- chunks: "all",
163
- test: (module, chunks) => {
164
- const moduleName = module.nameForCondition ? module.nameForCondition() : '';
165
- return /[\\/]node_modules[\\/]/.test(moduleName) ||
166
- appComponents.some(comp => comp === moduleName);
104
+ nsWebpack.processAppComponents(appComponents, platform);
105
+ const config = {
106
+ mode: production ? 'production' : 'development',
107
+ context: appFullPath,
108
+ externals,
109
+ watchOptions: {
110
+ ignored: [
111
+ appResourcesFullPath,
112
+ // Don't watch hidden files
113
+ '**/.*',
114
+ ],
115
+ },
116
+ target: nativescriptTarget,
117
+ entry: entries,
118
+ output: {
119
+ pathinfo: false,
120
+ path: dist,
121
+ sourceMapFilename,
122
+ libraryTarget: 'commonjs2',
123
+ filename: '[name].js',
124
+ globalObject: 'global',
125
+ hashSalt,
126
+ },
127
+ resolve: {
128
+ extensions: ['.ts', '.js', '.scss', '.css'],
129
+ // Resolve {N} system modules from @nativescript/core
130
+ modules: [resolve(__dirname, `node_modules/${coreModulesPackageName}`), resolve(__dirname, 'node_modules'), `node_modules/${coreModulesPackageName}`, 'node_modules'],
131
+ alias,
132
+ // resolve symlinks to symlinked modules
133
+ symlinks: true,
134
+ },
135
+ resolveLoader: {
136
+ // don't resolve symlinks to symlinked loaders
137
+ symlinks: false,
138
+ },
139
+ node: {
140
+ // Disable node shims that conflict with NativeScript
141
+ http: false,
142
+ timers: false,
143
+ setImmediate: false,
144
+ fs: 'empty',
145
+ __dirname: false,
146
+ },
147
+ devtool: hiddenSourceMap ? 'hidden-source-map' : sourceMap ? 'inline-source-map' : 'none',
148
+ optimization: {
149
+ runtimeChunk: 'single',
150
+ noEmitOnErrors: noEmitOnErrorFromTSConfig,
151
+ splitChunks: {
152
+ cacheGroups: {
153
+ vendor: {
154
+ name: 'vendor',
155
+ chunks: 'all',
156
+ test: (module, chunks) => {
157
+ const moduleName = module.nameForCondition ? module.nameForCondition() : '';
158
+ return /[\\/]node_modules[\\/]/.test(moduleName) || appComponents.some((comp) => comp === moduleName);
159
+ },
160
+ enforce: true,
161
+ },
162
+ },
163
+ },
164
+ minimize: !!uglify,
165
+ minimizer: [
166
+ new TerserPlugin({
167
+ parallel: true,
168
+ cache: !ci,
169
+ sourceMap: isAnySourceMapEnabled,
170
+ terserOptions: {
171
+ output: {
172
+ comments: false,
173
+ semicolons: !isAnySourceMapEnabled,
174
+ },
175
+ compress: {
176
+ // The Android SBG has problems parsing the output
177
+ // when these options are enabled
178
+ collapse_vars: platform !== 'android',
179
+ sequences: platform !== 'android',
180
+ // For v8 Compatibility
181
+ keep_infinity: true, // for V8
182
+ reduce_funcs: false, // for V8
183
+ // custom
184
+ drop_console: production,
185
+ drop_debugger: true,
186
+ global_defs: {
187
+ __UGLIFIED__: true,
188
+ },
189
+ },
190
+ // Required for Element Level CSS, Observable Events, & Android Frame
191
+ keep_classnames: true,
192
+ },
193
+ }),
194
+ ],
195
+ },
196
+ module: {
197
+ rules: [
198
+ {
199
+ include: join(appFullPath, entryPath),
200
+ use: [
201
+ // Require all Android app components
202
+ platform === 'android' && {
203
+ loader: '@nativescript/webpack/helpers/android-app-components-loader',
204
+ options: { modules: appComponents },
205
+ },
167
206
 
168
- },
169
- enforce: true,
170
- },
171
- }
172
- },
173
- minimize: !!uglify,
174
- minimizer: [
175
- new TerserPlugin({
176
- parallel: true,
177
- cache: true,
178
- sourceMap: isAnySourceMapEnabled,
179
- terserOptions: {
180
- output: {
181
- comments: false,
182
- semicolons: !isAnySourceMapEnabled
183
- },
184
- compress: {
185
- // The Android SBG has problems parsing the output
186
- // when these options are enabled
187
- 'collapse_vars': platform !== "android",
188
- sequences: platform !== "android",
189
- }
190
- }
191
- })
192
- ],
193
- },
194
- module: {
195
- rules: [
196
- {
197
- include: join(appFullPath, entryPath),
198
- use: [
199
- // Require all Android app components
200
- platform === "android" && {
201
- loader: "@nativescript/webpack/helpers/android-app-components-loader",
202
- options: { modules: appComponents }
203
- },
207
+ {
208
+ loader: '@nativescript/webpack/bundle-config-loader',
209
+ options: {
210
+ loadCss: !snapshot, // load the application css if in debug mode
211
+ unitTesting,
212
+ appFullPath,
213
+ projectRoot,
214
+ ignoredFiles: nsWebpack.getUserDefinedEntries(entries, platform),
215
+ },
216
+ },
217
+ ].filter((loader) => !!loader),
218
+ },
204
219
 
205
- {
206
- loader: "@nativescript/webpack/bundle-config-loader",
207
- options: {
208
- loadCss: !snapshot, // load the application css if in debug mode
209
- unitTesting,
210
- appFullPath,
211
- projectRoot,
212
- ignoredFiles: nsWebpack.getUserDefinedEntries(entries, platform)
213
- }
214
- },
215
- ].filter(loader => !!loader)
216
- },
220
+ {
221
+ test: /\.(ts|css|scss|html|xml)$/,
222
+ use: '@nativescript/webpack/hmr/hot-loader',
223
+ },
217
224
 
218
- {
219
- test: /\.(ts|css|scss|html|xml)$/,
220
- use: "@nativescript/webpack/hmr/hot-loader"
221
- },
225
+ { test: /\.(html|xml)$/, use: '@nativescript/webpack/helpers/xml-namespace-loader' },
222
226
 
223
- { test: /\.(html|xml)$/, use: "@nativescript/webpack/helpers/xml-namespace-loader" },
227
+ {
228
+ test: /\.css$/,
229
+ use: '@nativescript/webpack/helpers/css2json-loader',
230
+ },
224
231
 
225
- {
226
- test: /\.css$/,
227
- use: "@nativescript/webpack/helpers/css2json-loader"
228
- },
232
+ {
233
+ test: /\.scss$/,
234
+ use: ['@nativescript/webpack/helpers/css2json-loader', 'sass-loader'],
235
+ },
229
236
 
230
- {
231
- test: /\.scss$/,
232
- use: [
233
- "@nativescript/webpack/helpers/css2json-loader",
234
- "sass-loader"
235
- ]
236
- },
237
+ {
238
+ test: /\.ts$/,
239
+ use: {
240
+ loader: 'ts-loader',
241
+ options: {
242
+ configFile: tsConfigPath,
243
+ // https://github.com/TypeStrong/ts-loader/blob/ea2fcf925ec158d0a536d1e766adfec6567f5fb4/README.md#faster-builds
244
+ // https://github.com/TypeStrong/ts-loader/blob/ea2fcf925ec158d0a536d1e766adfec6567f5fb4/README.md#hot-module-replacement
245
+ transpileOnly: true,
246
+ allowTsInNodeModules: true,
247
+ compilerOptions: {
248
+ sourceMap: isAnySourceMapEnabled,
249
+ declaration: false,
250
+ },
251
+ getCustomTransformers: (program) => ({
252
+ before: [require('@nativescript/webpack/transformers/ns-transform-native-classes').default],
253
+ }),
254
+ },
255
+ },
256
+ },
257
+ ],
258
+ },
259
+ plugins: [
260
+ // Define useful constants like TNS_WEBPACK
261
+ new webpack.DefinePlugin({
262
+ 'global.TNS_WEBPACK': 'true',
263
+ 'global.isAndroid': platform === 'android',
264
+ 'global.isIOS': platform === 'ios',
265
+ process: 'global.process',
266
+ }),
267
+ // Remove all files from the out dir.
268
+ new CleanWebpackPlugin({
269
+ cleanOnceBeforeBuildPatterns: itemsToClean,
270
+ verbose: !!verbose,
271
+ }),
272
+ // Copy assets
273
+ new CopyWebpackPlugin([{ from: { glob: 'assets/**', dot: false } }, { from: { glob: 'fonts/**', dot: false } }, { from: { glob: '**/*.jpg', dot: false } }, { from: { glob: '**/*.png', dot: false } }], copyIgnore),
274
+ new nsWebpack.GenerateNativeScriptEntryPointsPlugin('bundle'),
275
+ // For instructions on how to set up workers with webpack
276
+ // check out https://github.com/nativescript/worker-loader
277
+ new NativeScriptWorkerPlugin(),
278
+ new nsWebpack.PlatformFSPlugin({
279
+ platform,
280
+ platforms,
281
+ }),
282
+ // Does IPC communication with the {N} CLI to notify events when running in watch mode.
283
+ new nsWebpack.WatchStateLoggerPlugin(),
284
+ // https://github.com/TypeStrong/ts-loader/blob/ea2fcf925ec158d0a536d1e766adfec6567f5fb4/README.md#faster-builds
285
+ // https://github.com/TypeStrong/ts-loader/blob/ea2fcf925ec158d0a536d1e766adfec6567f5fb4/README.md#hot-module-replacement
286
+ new ForkTsCheckerWebpackPlugin({
287
+ async: false,
288
+ typescript: {
289
+ configFile: tsConfigPath,
290
+ memoryLimit: 4096,
291
+ diagnosticOptions: {
292
+ syntactic: true,
293
+ semantic: true,
294
+ },
295
+ },
296
+ }),
297
+ ],
298
+ };
237
299
 
238
- {
239
- test: /\.ts$/,
240
- use: {
241
- loader: "ts-loader",
242
- options: {
243
- configFile: tsConfigPath,
244
- // https://github.com/TypeStrong/ts-loader/blob/ea2fcf925ec158d0a536d1e766adfec6567f5fb4/README.md#faster-builds
245
- // https://github.com/TypeStrong/ts-loader/blob/ea2fcf925ec158d0a536d1e766adfec6567f5fb4/README.md#hot-module-replacement
246
- transpileOnly: true,
247
- allowTsInNodeModules: true,
248
- compilerOptions: {
249
- sourceMap: isAnySourceMapEnabled,
250
- declaration: false
251
- },
252
- getCustomTransformers: (program) => ({
253
- before: [
254
- require("@nativescript/webpack/transformers/ns-transform-native-classes").default
255
- ]
256
- })
257
- },
258
- }
259
- },
260
- ]
261
- },
262
- plugins: [
263
- // Define useful constants like TNS_WEBPACK
264
- new webpack.DefinePlugin({
265
- "global.TNS_WEBPACK": "true",
266
- "global.isAndroid": platform === 'android',
267
- "global.isIOS": platform === 'ios',
268
- "process": "global.process",
269
- }),
270
- // Remove all files from the out dir.
271
- new CleanWebpackPlugin({
272
- cleanOnceBeforeBuildPatterns: itemsToClean,
273
- verbose: !!verbose
274
- }),
275
- // Copy assets
276
- new CopyWebpackPlugin([
277
- { from: { glob: 'assets/**', dot: false } },
278
- { from: { glob: 'fonts/**', dot: false } },
279
- { from: { glob: '**/*.jpg', dot: false } },
280
- { from: { glob: '**/*.png', dot: false } },
281
- ], copyIgnore),
282
- new nsWebpack.GenerateNativeScriptEntryPointsPlugin("bundle"),
283
- // For instructions on how to set up workers with webpack
284
- // check out https://github.com/nativescript/worker-loader
285
- new NativeScriptWorkerPlugin(),
286
- new nsWebpack.PlatformFSPlugin({
287
- platform,
288
- platforms,
289
- }),
290
- // Does IPC communication with the {N} CLI to notify events when running in watch mode.
291
- new nsWebpack.WatchStateLoggerPlugin(),
292
- // https://github.com/TypeStrong/ts-loader/blob/ea2fcf925ec158d0a536d1e766adfec6567f5fb4/README.md#faster-builds
293
- // https://github.com/TypeStrong/ts-loader/blob/ea2fcf925ec158d0a536d1e766adfec6567f5fb4/README.md#hot-module-replacement
294
- new ForkTsCheckerWebpackPlugin({
295
- async: false,
296
- typescript: {
297
- configFile: tsConfigPath,
298
- memoryLimit: 4096,
299
- diagnosticOptions: {
300
- syntactic: true,
301
- semantic: true
302
- }
303
- }
304
- })
305
- ],
306
- };
300
+ if (report) {
301
+ // Generate report files for bundles content
302
+ config.plugins.push(
303
+ new BundleAnalyzerPlugin({
304
+ analyzerMode: 'static',
305
+ openAnalyzer: false,
306
+ generateStatsFile: true,
307
+ reportFilename: resolve(projectRoot, 'report', `report.html`),
308
+ statsFilename: resolve(projectRoot, 'report', `stats.json`),
309
+ })
310
+ );
311
+ }
307
312
 
308
- if (report) {
309
- // Generate report files for bundles content
310
- config.plugins.push(new BundleAnalyzerPlugin({
311
- analyzerMode: "static",
312
- openAnalyzer: false,
313
- generateStatsFile: true,
314
- reportFilename: resolve(projectRoot, "report", `report.html`),
315
- statsFilename: resolve(projectRoot, "report", `stats.json`),
316
- }));
317
- }
313
+ if (snapshot) {
314
+ config.plugins.push(
315
+ new nsWebpack.NativeScriptSnapshotPlugin({
316
+ chunk: 'vendor',
317
+ requireModules: ['@nativescript/core/bundle-entry-points'],
318
+ projectRoot,
319
+ webpackConfig: config,
320
+ snapshotInDocker,
321
+ skipSnapshotTools,
322
+ useLibs,
323
+ })
324
+ );
325
+ }
318
326
 
319
- if (snapshot) {
320
- config.plugins.push(new nsWebpack.NativeScriptSnapshotPlugin({
321
- chunk: "vendor",
322
- requireModules: [
323
- "@nativescript/core/bundle-entry-points",
324
- ],
325
- projectRoot,
326
- webpackConfig: config,
327
- snapshotInDocker,
328
- skipSnapshotTools,
329
- useLibs
330
- }));
331
- }
327
+ if (hmr) {
328
+ config.plugins.push(new webpack.HotModuleReplacementPlugin());
329
+ }
332
330
 
333
- if (hmr) {
334
- config.plugins.push(new webpack.HotModuleReplacementPlugin());
335
- }
336
-
337
- return config;
331
+ return config;
338
332
  };