Signed-off-by: lizhouze <lizhouze@huawei.com>
This commit is contained in:
lizhouze
2022-09-01 18:58:50 +08:00
parent 2f2ab81880
commit 860ed1a0c6
2 changed files with 10 additions and 3 deletions
+9 -2
View File
@@ -89,7 +89,11 @@ class GenAbcPlugin {
newContent = `\n\n\n\n\n\n\n\n\n\n\n\n\n\n` + newContent;
}
const keyPath = key.replace(/\.js$/, firstFileEXT)
writeFileSync(newContent, path.resolve(output, keyPath), key);
writeFileSync(newContent, path.resolve(output, keyPath), true);
} else if (output && path.extname(key) === '.json' &&
process.env.DEVICE_LEVEL === 'card') {
writeFileSync(assets[key].source(),
path.resolve(output, key.replace(/\.json$/, '.json')), false);
}
})
});
@@ -119,12 +123,15 @@ function checkWorksFile(assetPath, workerFile) {
return true;
}
function writeFileSync(inputString, output, jsBundleFile) {
function writeFileSync(inputString, output, isToBin) {
const parent = path.join(output, '..');
if (!(fs.existsSync(parent) && fs.statSync(parent).isDirectory())) {
mkDir(parent);
}
fs.writeFileSync(output, inputString);
if (!isToBin) {
return;
}
if (fs.existsSync(output)) {
let fileSize = fs.statSync(output).size;
intermediateJsBundle.push({path: output, size: fileSize});
+1 -1
View File
@@ -214,7 +214,7 @@ function setArkPlugin(env, workerFile) {
}
config.plugins.push(new GenAbcPlugin(process.env.buildPath, arkDir, nodeJs, workerFile,
env.buildMode === 'debug'))
if (env.buildMode === 'release' && process.env.DEVICE_LEVEL !== 'card') {
if (env.buildMode === 'release') {
config.output.path = path.join(process.env.cachePath, "releaseAssets",
path.basename(process.env.buildPath));
}