Skip to content

Commit 01ea2a2

Browse files
committed
chore: webpack config consistency
1 parent 90d208c commit 01ea2a2

File tree

5 files changed

+29
-29
lines changed

5 files changed

+29
-29
lines changed

packages/webpack/templates/webpack.angular.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ module.exports = (env) => {
5656
snapshotInDocker, // --env.snapshotInDocker
5757
skipSnapshotTools, // --env.skipSnapshotTools
5858
compileSnapshot, // --env.compileSnapshot
59-
appComponents = [],
60-
entries = {}
59+
appComponents = [],
60+
entries = {},
6161
} = env;
6262

6363
const { fileReplacements, copyReplacements } = parseWorkspaceConfig(platform, configuration, projectName);
@@ -143,9 +143,9 @@ module.exports = (env) => {
143143
}
144144

145145
const noEmitOnErrorFromTSConfig = getNoEmitOnErrorFromTSConfig(tsConfigName);
146-
147-
appComponents.push("@nativescript/core/ui/frame",
148-
"@nativescript/core/ui/frame/activity");
146+
147+
// Add your custom Activities, Services and other android app components here.
148+
appComponents.push('@nativescript/core/ui/frame', '@nativescript/core/ui/frame/activity');
149149

150150
nsWebpack.processAppComponents(appComponents, platform);
151151
const config = {

packages/webpack/templates/webpack.javascript.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ const TerserPlugin = require('terser-webpack-plugin');
1212
const hashSalt = Date.now().toString();
1313

1414
module.exports = (env) => {
15-
// Add your custom Activities, Services and other android app components here.
16-
const appComponents = env.appComponents || [];
17-
appComponents.push(...['@nativescript/core/ui/frame', '@nativescript/core/ui/frame/activity']);
18-
1915
const platform = env && ((env.android && 'android') || (env.ios && 'ios') || env.platform);
2016
if (!platform) {
2117
throw new Error('You need to provide a target platform!');
@@ -52,6 +48,8 @@ module.exports = (env) => {
5248
skipSnapshotTools, // --env.skipSnapshotTools
5349
ci, // --env.ci
5450
compileSnapshot, // --env.compileSnapshot
51+
appComponents = [],
52+
entries = {},
5553
} = env;
5654

5755
const useLibs = compileSnapshot;
@@ -79,8 +77,7 @@ module.exports = (env) => {
7977

8078
const entryModule = nsWebpack.getEntryModule(appFullPath, platform);
8179
const entryPath = `.${sep}${entryModule}.js`;
82-
const entries = env.entries || {};
83-
entries.bundle = entryPath;
80+
Object.assign(entries, { bundle: entryPath }, entries);
8481

8582
const areCoreModulesExternal = Array.isArray(env.externals) && env.externals.some((e) => e.indexOf('@nativescript') > -1);
8683
if (platform === 'ios' && !areCoreModulesExternal && !testing) {
@@ -95,6 +92,9 @@ module.exports = (env) => {
9592
itemsToClean.push(`${join(projectRoot, 'platforms', 'android', 'app', 'build', 'configurations', 'nativescript-android-snapshot')}`);
9693
}
9794

95+
// Add your custom Activities, Services and other android app components here.
96+
appComponents.push('@nativescript/core/ui/frame', '@nativescript/core/ui/frame/activity');
97+
9898
nsWebpack.processAppComponents(appComponents, platform);
9999
const config = {
100100
mode: production ? 'production' : 'development',

packages/webpack/templates/webpack.svelte.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ const preprocessConfig = require('./svelte.config.js');
1616
const svelteNativePreprocessor = require('svelte-native-preprocessor');
1717

1818
module.exports = (env) => {
19-
// Add your custom Activities, Services and other Android app components here.
20-
const appComponents = env.appComponents || [];
21-
appComponents.push(...['@nativescript/core/ui/frame', '@nativescript/core/ui/frame/activity']);
22-
2319
const platform = env && ((env.android && 'android') || (env.ios && 'ios') || env.platform);
2420
if (!platform) {
2521
throw new Error('You need to provide a target platform!');
@@ -56,6 +52,8 @@ module.exports = (env) => {
5652
snapshotInDocker, // --env.snapshotInDocker
5753
skipSnapshotTools, // --env.skipSnapshotTools
5854
compileSnapshot, // --env.compileSnapshot
55+
appComponents = [],
56+
entries = {},
5957
} = env;
6058

6159
const useLibs = compileSnapshot;
@@ -83,8 +81,7 @@ module.exports = (env) => {
8381

8482
const entryModule = nsWebpack.getEntryModule(appFullPath, platform);
8583
const entryPath = `.${sep}${entryModule}.ts`;
86-
const entries = env.entries || {};
87-
entries.bundle = entryPath;
84+
Object.assign(entries, { bundle: entryPath }, entries);
8885

8986
const tsConfigPath = resolve(projectRoot, 'tsconfig.json');
9087

@@ -103,6 +100,9 @@ module.exports = (env) => {
103100

104101
const noEmitOnErrorFromTSConfig = getNoEmitOnErrorFromTSConfig(tsConfigPath);
105102

103+
// Add your custom Activities, Services and other android app components here.
104+
appComponents.push('@nativescript/core/ui/frame', '@nativescript/core/ui/frame/activity');
105+
106106
nsWebpack.processAppComponents(appComponents, platform);
107107
const config = {
108108
mode: production ? 'production' : 'development',

packages/webpack/templates/webpack.typescript.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ const TerserPlugin = require('terser-webpack-plugin');
1414
const hashSalt = Date.now().toString();
1515

1616
module.exports = (env) => {
17-
// Add your custom Activities, Services and other Android app components here.
18-
const appComponents = env.appComponents || [];
19-
appComponents.push(...['@nativescript/core/ui/frame', '@nativescript/core/ui/frame/activity']);
20-
2117
const platform = env && ((env.android && 'android') || (env.ios && 'ios') || env.platform);
2218
if (!platform) {
2319
throw new Error('You need to provide a target platform!');
@@ -54,6 +50,8 @@ module.exports = (env) => {
5450
snapshotInDocker, // --env.snapshotInDocker
5551
skipSnapshotTools, // --env.skipSnapshotTools
5652
compileSnapshot, // --env.compileSnapshot
53+
appComponents = [],
54+
entries = {},
5755
} = env;
5856

5957
const useLibs = compileSnapshot;
@@ -81,8 +79,7 @@ module.exports = (env) => {
8179

8280
const entryModule = nsWebpack.getEntryModule(appFullPath, platform);
8381
const entryPath = `.${sep}${entryModule}.ts`;
84-
const entries = env.entries || {};
85-
entries.bundle = entryPath;
82+
Object.assign(entries, { bundle: entryPath }, entries);
8683

8784
const tsConfigPath = resolve(projectRoot, 'tsconfig.json');
8885

@@ -101,6 +98,9 @@ module.exports = (env) => {
10198

10299
const noEmitOnErrorFromTSConfig = getNoEmitOnErrorFromTSConfig(tsConfigPath);
103100

101+
// Add your custom Activities, Services and other android app components here.
102+
appComponents.push('@nativescript/core/ui/frame', '@nativescript/core/ui/frame/activity');
103+
104104
nsWebpack.processAppComponents(appComponents, platform);
105105
const config = {
106106
mode: production ? 'production' : 'development',

packages/webpack/templates/webpack.vue.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ const { NativeScriptWorkerPlugin } = require('nativescript-worker-loader/NativeS
1515
const hashSalt = Date.now().toString();
1616

1717
module.exports = (env) => {
18-
// Add your custom Activities, Services and other android app components here.
19-
const appComponents = env.appComponents || [];
20-
appComponents.push(...['@nativescript/core/ui/frame', '@nativescript/core/ui/frame/activity']);
21-
2218
const platform = env && ((env.android && 'android') || (env.ios && 'ios') || env.platform);
2319
if (!platform) {
2420
throw new Error('You need to provide a target platform!');
@@ -54,6 +50,8 @@ module.exports = (env) => {
5450
snapshotInDocker, // --env.snapshotInDocker
5551
skipSnapshotTools, // --env.skipSnapshotTools
5652
compileSnapshot, // --env.compileSnapshot
53+
appComponents = [],
54+
entries = {},
5755
} = env;
5856

5957
const useLibs = compileSnapshot;
@@ -82,8 +80,7 @@ module.exports = (env) => {
8280

8381
const entryModule = nsWebpack.getEntryModule(appFullPath, platform);
8482
const entryPath = `.${sep}${entryModule}`;
85-
const entries = env.entries || {};
86-
entries.bundle = entryPath;
83+
Object.assign(entries, { bundle: entryPath }, entries);
8784

8885
const areCoreModulesExternal = Array.isArray(env.externals) && env.externals.some((e) => e.indexOf('@nativescript') > -1);
8986
if (platform === 'ios' && !areCoreModulesExternal && !testing) {
@@ -99,6 +96,9 @@ module.exports = (env) => {
9996
itemsToClean.push(`${join(projectRoot, 'platforms', 'android', 'app', 'build', 'configurations', 'nativescript-android-snapshot')}`);
10097
}
10198

99+
// Add your custom Activities, Services and other android app components here.
100+
appComponents.push('@nativescript/core/ui/frame', '@nativescript/core/ui/frame/activity');
101+
102102
nsWebpack.processAppComponents(appComponents, platform);
103103
const config = {
104104
mode: mode,

0 commit comments

Comments
 (0)