mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
feat(monorepo): build with esm modules (#8729)
fixes https://github.com/NativeScript/NativeScript/issues/8739
This commit is contained in:
committed by
Nathan Walker
parent
5658e638d5
commit
fc64fc3ed9
@@ -49,6 +49,7 @@ module.exports = env => {
|
||||
hiddenSourceMap, // --env.hiddenSourceMap
|
||||
hmr, // --env.hmr,
|
||||
unitTesting, // --env.unitTesting,
|
||||
testing, // --env.testing
|
||||
verbose, // --env.verbose
|
||||
snapshotInDocker, // --env.snapshotInDocker
|
||||
skipSnapshotTools, // --env.skipSnapshotTools
|
||||
@@ -82,7 +83,7 @@ module.exports = env => {
|
||||
entries.bundle = entryPath;
|
||||
|
||||
const areCoreModulesExternal = Array.isArray(env.externals) && env.externals.some(e => e.indexOf("@nativescript") > -1);
|
||||
if (platform === "ios" && !areCoreModulesExternal) {
|
||||
if (platform === "ios" && !areCoreModulesExternal && !testing) {
|
||||
entries["tns_modules/@nativescript/core/inspector_modules"] = "inspector_modules";
|
||||
};
|
||||
|
||||
@@ -190,7 +191,7 @@ module.exports = env => {
|
||||
use: [
|
||||
// Require all Android app components
|
||||
platform === "android" && {
|
||||
loader: "@nativescript/webpack/android-app-components-loader",
|
||||
loader: "@nativescript/webpack/helpers/android-app-components-loader",
|
||||
options: { modules: appComponents }
|
||||
},
|
||||
|
||||
@@ -212,17 +213,17 @@ module.exports = env => {
|
||||
use: "@nativescript/webpack/hmr/hot-loader"
|
||||
},
|
||||
|
||||
{ test: /\.(html|xml)$/, use: "@nativescript/webpack/xml-namespace-loader" },
|
||||
{ test: /\.(html|xml)$/, use: "@nativescript/webpack/helpers/xml-namespace-loader" },
|
||||
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: "@nativescript/webpack/css2json-loader"
|
||||
use: "@nativescript/webpack/helpers/css2json-loader"
|
||||
},
|
||||
|
||||
{
|
||||
test: /\.scss$/,
|
||||
use: [
|
||||
"@nativescript/webpack/css2json-loader",
|
||||
"@nativescript/webpack/helpers/css2json-loader",
|
||||
"sass-loader"
|
||||
]
|
||||
},
|
||||
@@ -232,6 +233,8 @@ module.exports = env => {
|
||||
// Define useful constants like TNS_WEBPACK
|
||||
new webpack.DefinePlugin({
|
||||
"global.TNS_WEBPACK": "true",
|
||||
"global.isAndroid": platform === 'android',
|
||||
"global.isIOS": platform === 'ios',
|
||||
"process": "global.process",
|
||||
}),
|
||||
// Remove all files from the out dir.
|
||||
@@ -291,9 +294,5 @@ module.exports = env => {
|
||||
config.plugins.push(new webpack.HotModuleReplacementPlugin());
|
||||
}
|
||||
|
||||
config.stats = {
|
||||
warnings: false
|
||||
};
|
||||
|
||||
return config;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user