diff --git a/ace-loader/src/genAbc-plugin.js b/ace-loader/src/genAbc-plugin.js index b196ddb..4a31add 100644 --- a/ace-loader/src/genAbc-plugin.js +++ b/ace-loader/src/genAbc-plugin.js @@ -77,9 +77,8 @@ class GenAbcPlugin { const keyPath = key.replace(/\.js$/, firstFileEXT) 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); + process.env.DEVICE_LEVEL === 'card' && !checkI18n(key)) { + writeFileSync(assets[key].source(), path.resolve(output, key), false); } }) }); @@ -89,6 +88,15 @@ class GenAbcPlugin { } } +function checkI18n(key) { + const outI18nPath = path.resolve(output, 'i18n', key); + const projectI18nPath = outI18nPath.replace(output, process.env.projectPath); + if (fs.existsSync(projectI18nPath)) { + return true; + } + return false; +} + function checkWorksFile(assetPath, workerFile) { if (workerFile === null) { if (assetPath.search("./workers/") !== 0) {