mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
refactor(webpack): drop custom flavor helper & explicitly set in each config
This commit is contained in:

committed by
Nathan Walker

parent
5452b89735
commit
3bdc34aec3
@ -1,4 +1,5 @@
|
||||
import { extname, resolve } from 'path';
|
||||
import { merge } from 'webpack-merge';
|
||||
import Config from 'webpack-chain';
|
||||
import { existsSync } from 'fs';
|
||||
|
||||
@ -222,6 +223,14 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
|
||||
])
|
||||
);
|
||||
|
||||
config.plugin('DefinePlugin').tap((args) => {
|
||||
args[0] = merge(args[0], {
|
||||
__UI_USE_EXTERNAL_RENDERER__: true,
|
||||
});
|
||||
|
||||
return args;
|
||||
});
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,6 @@ import { applyFileReplacements } from '../helpers/fileReplacements';
|
||||
import { addCopyRule, applyCopyRules } from '../helpers/copyRules';
|
||||
import { WatchStatePlugin } from '../plugins/WatchStatePlugin';
|
||||
import { getProjectFilePath } from '../helpers/project';
|
||||
import { projectUsesCustomFlavor } from '../helpers/flavor';
|
||||
import { hasDependency } from '../helpers/dependencies';
|
||||
import { applyDotEnvPlugin } from '../helpers/dotEnv';
|
||||
import { env as _env, IWebpackEnv } from '../index';
|
||||
@ -354,7 +353,7 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
|
||||
mode === 'development' ? JSON.stringify(getIPS()) : `[]`,
|
||||
__CSS_PARSER__: JSON.stringify(getValue('cssParser', 'css-tree')),
|
||||
__UI_USE_XML_PARSER__: true,
|
||||
__UI_USE_EXTERNAL_RENDERER__: projectUsesCustomFlavor(),
|
||||
__UI_USE_EXTERNAL_RENDERER__: false,
|
||||
__ANDROID__: platform === 'android',
|
||||
__IOS__: platform === 'ios',
|
||||
/* for compat only */ 'global.isAndroid': platform === 'android',
|
||||
|
@ -26,6 +26,7 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
|
||||
args[0] = merge(args[0], {
|
||||
/** For various libraries in the React ecosystem. */
|
||||
__TEST__: false,
|
||||
__UI_USE_EXTERNAL_RENDERER__: true,
|
||||
/**
|
||||
* Primarily for React Fast Refresh plugin, but technically the allowHmrInProduction option could be used instead.
|
||||
* Worth including anyway, as there are plenty of Node libraries that use this flag.
|
||||
|
@ -1,11 +1,12 @@
|
||||
import { merge } from 'webpack-merge';
|
||||
import Config from 'webpack-chain';
|
||||
|
||||
import { getProjectFilePath } from '../helpers/project';
|
||||
import { hasDependency } from '../helpers/dependencies';
|
||||
import { getPlatformName } from '../helpers/platform';
|
||||
import { env as _env, IWebpackEnv } from '../index';
|
||||
import { error } from '../helpers/log';
|
||||
import base from './base';
|
||||
import { hasDependency } from '../helpers/dependencies';
|
||||
|
||||
export default function (config: Config, env: IWebpackEnv = _env): Config {
|
||||
base(config, env);
|
||||
@ -84,6 +85,14 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
|
||||
});
|
||||
}
|
||||
|
||||
config.plugin('DefinePlugin').tap((args) => {
|
||||
args[0] = merge(args[0], {
|
||||
__UI_USE_EXTERNAL_RENDERER__: true,
|
||||
});
|
||||
|
||||
return args;
|
||||
});
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
|
@ -88,6 +88,14 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
|
||||
// add an alias for vue, since some plugins may try to import it
|
||||
config.resolve.alias.set('vue', 'nativescript-vue');
|
||||
|
||||
config.plugin('DefinePlugin').tap((args) => {
|
||||
args[0] = merge(args[0], {
|
||||
__UI_USE_EXTERNAL_RENDERER__: true,
|
||||
});
|
||||
|
||||
return args;
|
||||
});
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user