mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
chore: webpack config consistency
This commit is contained in:
@ -56,8 +56,8 @@ module.exports = (env) => {
|
|||||||
snapshotInDocker, // --env.snapshotInDocker
|
snapshotInDocker, // --env.snapshotInDocker
|
||||||
skipSnapshotTools, // --env.skipSnapshotTools
|
skipSnapshotTools, // --env.skipSnapshotTools
|
||||||
compileSnapshot, // --env.compileSnapshot
|
compileSnapshot, // --env.compileSnapshot
|
||||||
appComponents = [],
|
appComponents = [],
|
||||||
entries = {}
|
entries = {},
|
||||||
} = env;
|
} = env;
|
||||||
|
|
||||||
const { fileReplacements, copyReplacements } = parseWorkspaceConfig(platform, configuration, projectName);
|
const { fileReplacements, copyReplacements } = parseWorkspaceConfig(platform, configuration, projectName);
|
||||||
@ -143,9 +143,9 @@ module.exports = (env) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const noEmitOnErrorFromTSConfig = getNoEmitOnErrorFromTSConfig(tsConfigName);
|
const noEmitOnErrorFromTSConfig = getNoEmitOnErrorFromTSConfig(tsConfigName);
|
||||||
|
|
||||||
appComponents.push("@nativescript/core/ui/frame",
|
// Add your custom Activities, Services and other android app components here.
|
||||||
"@nativescript/core/ui/frame/activity");
|
appComponents.push('@nativescript/core/ui/frame', '@nativescript/core/ui/frame/activity');
|
||||||
|
|
||||||
nsWebpack.processAppComponents(appComponents, platform);
|
nsWebpack.processAppComponents(appComponents, platform);
|
||||||
const config = {
|
const config = {
|
||||||
|
@ -12,10 +12,6 @@ const TerserPlugin = require('terser-webpack-plugin');
|
|||||||
const hashSalt = Date.now().toString();
|
const hashSalt = Date.now().toString();
|
||||||
|
|
||||||
module.exports = (env) => {
|
module.exports = (env) => {
|
||||||
// Add your custom Activities, Services and other android app components here.
|
|
||||||
const appComponents = env.appComponents || [];
|
|
||||||
appComponents.push(...['@nativescript/core/ui/frame', '@nativescript/core/ui/frame/activity']);
|
|
||||||
|
|
||||||
const platform = env && ((env.android && 'android') || (env.ios && 'ios') || env.platform);
|
const platform = env && ((env.android && 'android') || (env.ios && 'ios') || env.platform);
|
||||||
if (!platform) {
|
if (!platform) {
|
||||||
throw new Error('You need to provide a target platform!');
|
throw new Error('You need to provide a target platform!');
|
||||||
@ -52,6 +48,8 @@ module.exports = (env) => {
|
|||||||
skipSnapshotTools, // --env.skipSnapshotTools
|
skipSnapshotTools, // --env.skipSnapshotTools
|
||||||
ci, // --env.ci
|
ci, // --env.ci
|
||||||
compileSnapshot, // --env.compileSnapshot
|
compileSnapshot, // --env.compileSnapshot
|
||||||
|
appComponents = [],
|
||||||
|
entries = {},
|
||||||
} = env;
|
} = env;
|
||||||
|
|
||||||
const useLibs = compileSnapshot;
|
const useLibs = compileSnapshot;
|
||||||
@ -79,8 +77,7 @@ module.exports = (env) => {
|
|||||||
|
|
||||||
const entryModule = nsWebpack.getEntryModule(appFullPath, platform);
|
const entryModule = nsWebpack.getEntryModule(appFullPath, platform);
|
||||||
const entryPath = `.${sep}${entryModule}.js`;
|
const entryPath = `.${sep}${entryModule}.js`;
|
||||||
const entries = env.entries || {};
|
Object.assign(entries, { bundle: entryPath }, entries);
|
||||||
entries.bundle = entryPath;
|
|
||||||
|
|
||||||
const areCoreModulesExternal = Array.isArray(env.externals) && env.externals.some((e) => e.indexOf('@nativescript') > -1);
|
const areCoreModulesExternal = Array.isArray(env.externals) && env.externals.some((e) => e.indexOf('@nativescript') > -1);
|
||||||
if (platform === 'ios' && !areCoreModulesExternal && !testing) {
|
if (platform === 'ios' && !areCoreModulesExternal && !testing) {
|
||||||
@ -95,6 +92,9 @@ module.exports = (env) => {
|
|||||||
itemsToClean.push(`${join(projectRoot, 'platforms', 'android', 'app', 'build', 'configurations', 'nativescript-android-snapshot')}`);
|
itemsToClean.push(`${join(projectRoot, 'platforms', 'android', 'app', 'build', 'configurations', 'nativescript-android-snapshot')}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add your custom Activities, Services and other android app components here.
|
||||||
|
appComponents.push('@nativescript/core/ui/frame', '@nativescript/core/ui/frame/activity');
|
||||||
|
|
||||||
nsWebpack.processAppComponents(appComponents, platform);
|
nsWebpack.processAppComponents(appComponents, platform);
|
||||||
const config = {
|
const config = {
|
||||||
mode: production ? 'production' : 'development',
|
mode: production ? 'production' : 'development',
|
||||||
|
@ -16,10 +16,6 @@ const preprocessConfig = require('./svelte.config.js');
|
|||||||
const svelteNativePreprocessor = require('svelte-native-preprocessor');
|
const svelteNativePreprocessor = require('svelte-native-preprocessor');
|
||||||
|
|
||||||
module.exports = (env) => {
|
module.exports = (env) => {
|
||||||
// Add your custom Activities, Services and other Android app components here.
|
|
||||||
const appComponents = env.appComponents || [];
|
|
||||||
appComponents.push(...['@nativescript/core/ui/frame', '@nativescript/core/ui/frame/activity']);
|
|
||||||
|
|
||||||
const platform = env && ((env.android && 'android') || (env.ios && 'ios') || env.platform);
|
const platform = env && ((env.android && 'android') || (env.ios && 'ios') || env.platform);
|
||||||
if (!platform) {
|
if (!platform) {
|
||||||
throw new Error('You need to provide a target platform!');
|
throw new Error('You need to provide a target platform!');
|
||||||
@ -56,6 +52,8 @@ module.exports = (env) => {
|
|||||||
snapshotInDocker, // --env.snapshotInDocker
|
snapshotInDocker, // --env.snapshotInDocker
|
||||||
skipSnapshotTools, // --env.skipSnapshotTools
|
skipSnapshotTools, // --env.skipSnapshotTools
|
||||||
compileSnapshot, // --env.compileSnapshot
|
compileSnapshot, // --env.compileSnapshot
|
||||||
|
appComponents = [],
|
||||||
|
entries = {},
|
||||||
} = env;
|
} = env;
|
||||||
|
|
||||||
const useLibs = compileSnapshot;
|
const useLibs = compileSnapshot;
|
||||||
@ -83,8 +81,7 @@ module.exports = (env) => {
|
|||||||
|
|
||||||
const entryModule = nsWebpack.getEntryModule(appFullPath, platform);
|
const entryModule = nsWebpack.getEntryModule(appFullPath, platform);
|
||||||
const entryPath = `.${sep}${entryModule}.ts`;
|
const entryPath = `.${sep}${entryModule}.ts`;
|
||||||
const entries = env.entries || {};
|
Object.assign(entries, { bundle: entryPath }, entries);
|
||||||
entries.bundle = entryPath;
|
|
||||||
|
|
||||||
const tsConfigPath = resolve(projectRoot, 'tsconfig.json');
|
const tsConfigPath = resolve(projectRoot, 'tsconfig.json');
|
||||||
|
|
||||||
@ -103,6 +100,9 @@ module.exports = (env) => {
|
|||||||
|
|
||||||
const noEmitOnErrorFromTSConfig = getNoEmitOnErrorFromTSConfig(tsConfigPath);
|
const noEmitOnErrorFromTSConfig = getNoEmitOnErrorFromTSConfig(tsConfigPath);
|
||||||
|
|
||||||
|
// Add your custom Activities, Services and other android app components here.
|
||||||
|
appComponents.push('@nativescript/core/ui/frame', '@nativescript/core/ui/frame/activity');
|
||||||
|
|
||||||
nsWebpack.processAppComponents(appComponents, platform);
|
nsWebpack.processAppComponents(appComponents, platform);
|
||||||
const config = {
|
const config = {
|
||||||
mode: production ? 'production' : 'development',
|
mode: production ? 'production' : 'development',
|
||||||
|
@ -14,10 +14,6 @@ const TerserPlugin = require('terser-webpack-plugin');
|
|||||||
const hashSalt = Date.now().toString();
|
const hashSalt = Date.now().toString();
|
||||||
|
|
||||||
module.exports = (env) => {
|
module.exports = (env) => {
|
||||||
// Add your custom Activities, Services and other Android app components here.
|
|
||||||
const appComponents = env.appComponents || [];
|
|
||||||
appComponents.push(...['@nativescript/core/ui/frame', '@nativescript/core/ui/frame/activity']);
|
|
||||||
|
|
||||||
const platform = env && ((env.android && 'android') || (env.ios && 'ios') || env.platform);
|
const platform = env && ((env.android && 'android') || (env.ios && 'ios') || env.platform);
|
||||||
if (!platform) {
|
if (!platform) {
|
||||||
throw new Error('You need to provide a target platform!');
|
throw new Error('You need to provide a target platform!');
|
||||||
@ -54,6 +50,8 @@ module.exports = (env) => {
|
|||||||
snapshotInDocker, // --env.snapshotInDocker
|
snapshotInDocker, // --env.snapshotInDocker
|
||||||
skipSnapshotTools, // --env.skipSnapshotTools
|
skipSnapshotTools, // --env.skipSnapshotTools
|
||||||
compileSnapshot, // --env.compileSnapshot
|
compileSnapshot, // --env.compileSnapshot
|
||||||
|
appComponents = [],
|
||||||
|
entries = {},
|
||||||
} = env;
|
} = env;
|
||||||
|
|
||||||
const useLibs = compileSnapshot;
|
const useLibs = compileSnapshot;
|
||||||
@ -81,8 +79,7 @@ module.exports = (env) => {
|
|||||||
|
|
||||||
const entryModule = nsWebpack.getEntryModule(appFullPath, platform);
|
const entryModule = nsWebpack.getEntryModule(appFullPath, platform);
|
||||||
const entryPath = `.${sep}${entryModule}.ts`;
|
const entryPath = `.${sep}${entryModule}.ts`;
|
||||||
const entries = env.entries || {};
|
Object.assign(entries, { bundle: entryPath }, entries);
|
||||||
entries.bundle = entryPath;
|
|
||||||
|
|
||||||
const tsConfigPath = resolve(projectRoot, 'tsconfig.json');
|
const tsConfigPath = resolve(projectRoot, 'tsconfig.json');
|
||||||
|
|
||||||
@ -101,6 +98,9 @@ module.exports = (env) => {
|
|||||||
|
|
||||||
const noEmitOnErrorFromTSConfig = getNoEmitOnErrorFromTSConfig(tsConfigPath);
|
const noEmitOnErrorFromTSConfig = getNoEmitOnErrorFromTSConfig(tsConfigPath);
|
||||||
|
|
||||||
|
// Add your custom Activities, Services and other android app components here.
|
||||||
|
appComponents.push('@nativescript/core/ui/frame', '@nativescript/core/ui/frame/activity');
|
||||||
|
|
||||||
nsWebpack.processAppComponents(appComponents, platform);
|
nsWebpack.processAppComponents(appComponents, platform);
|
||||||
const config = {
|
const config = {
|
||||||
mode: production ? 'production' : 'development',
|
mode: production ? 'production' : 'development',
|
||||||
|
@ -15,10 +15,6 @@ const { NativeScriptWorkerPlugin } = require('nativescript-worker-loader/NativeS
|
|||||||
const hashSalt = Date.now().toString();
|
const hashSalt = Date.now().toString();
|
||||||
|
|
||||||
module.exports = (env) => {
|
module.exports = (env) => {
|
||||||
// Add your custom Activities, Services and other android app components here.
|
|
||||||
const appComponents = env.appComponents || [];
|
|
||||||
appComponents.push(...['@nativescript/core/ui/frame', '@nativescript/core/ui/frame/activity']);
|
|
||||||
|
|
||||||
const platform = env && ((env.android && 'android') || (env.ios && 'ios') || env.platform);
|
const platform = env && ((env.android && 'android') || (env.ios && 'ios') || env.platform);
|
||||||
if (!platform) {
|
if (!platform) {
|
||||||
throw new Error('You need to provide a target platform!');
|
throw new Error('You need to provide a target platform!');
|
||||||
@ -54,6 +50,8 @@ module.exports = (env) => {
|
|||||||
snapshotInDocker, // --env.snapshotInDocker
|
snapshotInDocker, // --env.snapshotInDocker
|
||||||
skipSnapshotTools, // --env.skipSnapshotTools
|
skipSnapshotTools, // --env.skipSnapshotTools
|
||||||
compileSnapshot, // --env.compileSnapshot
|
compileSnapshot, // --env.compileSnapshot
|
||||||
|
appComponents = [],
|
||||||
|
entries = {},
|
||||||
} = env;
|
} = env;
|
||||||
|
|
||||||
const useLibs = compileSnapshot;
|
const useLibs = compileSnapshot;
|
||||||
@ -82,8 +80,7 @@ module.exports = (env) => {
|
|||||||
|
|
||||||
const entryModule = nsWebpack.getEntryModule(appFullPath, platform);
|
const entryModule = nsWebpack.getEntryModule(appFullPath, platform);
|
||||||
const entryPath = `.${sep}${entryModule}`;
|
const entryPath = `.${sep}${entryModule}`;
|
||||||
const entries = env.entries || {};
|
Object.assign(entries, { bundle: entryPath }, entries);
|
||||||
entries.bundle = entryPath;
|
|
||||||
|
|
||||||
const areCoreModulesExternal = Array.isArray(env.externals) && env.externals.some((e) => e.indexOf('@nativescript') > -1);
|
const areCoreModulesExternal = Array.isArray(env.externals) && env.externals.some((e) => e.indexOf('@nativescript') > -1);
|
||||||
if (platform === 'ios' && !areCoreModulesExternal && !testing) {
|
if (platform === 'ios' && !areCoreModulesExternal && !testing) {
|
||||||
@ -99,6 +96,9 @@ module.exports = (env) => {
|
|||||||
itemsToClean.push(`${join(projectRoot, 'platforms', 'android', 'app', 'build', 'configurations', 'nativescript-android-snapshot')}`);
|
itemsToClean.push(`${join(projectRoot, 'platforms', 'android', 'app', 'build', 'configurations', 'nativescript-android-snapshot')}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add your custom Activities, Services and other android app components here.
|
||||||
|
appComponents.push('@nativescript/core/ui/frame', '@nativescript/core/ui/frame/activity');
|
||||||
|
|
||||||
nsWebpack.processAppComponents(appComponents, platform);
|
nsWebpack.processAppComponents(appComponents, platform);
|
||||||
const config = {
|
const config = {
|
||||||
mode: mode,
|
mode: mode,
|
||||||
|
Reference in New Issue
Block a user