avoid add head&tail js text into files of workers directory

Signed-off-by: hufeng <hufeng20@huawei.com>
Change-Id: Idff0d1ac7aabebb96c547acba7b66ba25d533adc
This commit is contained in:
hufeng
2021-09-18 16:43:34 +08:00
parent f2159f7105
commit 6ed3ac271a
2 changed files with 8 additions and 2 deletions
+4 -1
View File
@@ -66,7 +66,10 @@ class GenAbcPlugin {
keys.forEach(key => {
// choice *.js
if (output && webpackPath && path.extname(key) === '.js') {
const newContent = forward + assets[key].source() + last
let newContent = assets[key].source()
if (key.search('./workers/') != 0) {
newContent = forward + newContent + last
}
const keyPath = key.replace(/\.js$/, firstFileEXT)
writeFileSync(newContent, path.resolve(output, keyPath), key)
}
+4 -1
View File
@@ -54,7 +54,10 @@ class GenBinPlugin {
keys.forEach(key => {
// choice *.js
if (output && webpackPath && path.extname(key) === '.js') {
const newContent = forward + assets[key].source() + last
let newContent = assets[key].source()
if (key.search('./workers/') != 0) {
newContent = forward + newContent + last
}
const keyPath = key.replace(/\.js$/, firstFileEXT)
writeFileSync(newContent, path.resolve(output, keyPath), key)
}