mirror of
https://github.com/openharmony/developtools_ace-ets2bundle.git
synced 2026-07-18 16:04:32 -04:00
exclude commonjs bundle. Signed-off-by: lihong <lihong67@huawei.com> Change-Id: I0ea70cc94b247f009e6d21a3907314ab23ceb6d4
This commit is contained in:
@@ -73,6 +73,7 @@ function loadEntryObj(projectConfig) {
|
||||
const jsonString = fs.readFileSync(projectConfig.manifestFilePath).toString();
|
||||
manifest = JSON.parse(jsonString);
|
||||
} else if (projectConfig.aceModuleJsonPath && fs.existsSync(projectConfig.aceModuleJsonPath)) {
|
||||
process.env.compileMode = 'moduleJson';
|
||||
buildManifest(manifest, projectConfig.aceModuleJsonPath);
|
||||
} else {
|
||||
throw Error('\u001b[31m ERROR: the manifest file ' + projectConfig.manifestFilePath +
|
||||
|
||||
+27
-21
@@ -46,27 +46,6 @@ function initConfig(config) {
|
||||
poll: false,
|
||||
ignored: /node_modules/
|
||||
},
|
||||
optimization: {
|
||||
splitChunks: {
|
||||
chunks(chunk) {
|
||||
return !/^\.\/workers\//.test(chunk.name);
|
||||
},
|
||||
minSize: 0,
|
||||
cacheGroups: {
|
||||
vendors: {
|
||||
test: /[\\/]node_modules[\\/]/,
|
||||
priority: -10,
|
||||
name: "vendors",
|
||||
},
|
||||
commons: {
|
||||
name: 'commons',
|
||||
priority: -20,
|
||||
minChunks: 2,
|
||||
reuseExistingChunk: true
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
output: {
|
||||
path: path.resolve(__dirname, projectConfig.buildPath),
|
||||
filename: '[name].js',
|
||||
@@ -213,11 +192,38 @@ function setCopyPluginConfig(config) {
|
||||
config.plugins.push(new CopyPlugin({ patterns: copyPluginPattrens }));
|
||||
}
|
||||
|
||||
function setOptimizationConfig(config) {
|
||||
if (process.env.compileMode !== 'moduleJson') {
|
||||
config.optimization = {
|
||||
splitChunks: {
|
||||
chunks(chunk) {
|
||||
return !/^\.\/workers\//.test(chunk.name);
|
||||
},
|
||||
minSize: 0,
|
||||
cacheGroups: {
|
||||
vendors: {
|
||||
test: /[\\/]node_modules[\\/]/,
|
||||
priority: -10,
|
||||
name: "vendors",
|
||||
},
|
||||
commons: {
|
||||
name: 'commons',
|
||||
priority: -20,
|
||||
minChunks: 2,
|
||||
reuseExistingChunk: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = (env, argv) => {
|
||||
const config = {};
|
||||
setProjectConfig(env);
|
||||
loadEntryObj(projectConfig);
|
||||
initConfig(config);
|
||||
setOptimizationConfig(config);
|
||||
setCopyPluginConfig(config);
|
||||
|
||||
if (env.isPreview !== "true") {
|
||||
|
||||
Reference in New Issue
Block a user