diff --git a/ace-loader/src/lite/lite-image2bin.js b/ace-loader/src/lite/lite-image2bin.js index 9c59d98..e530705 100644 --- a/ace-loader/src/lite/lite-image2bin.js +++ b/ace-loader/src/lite/lite-image2bin.js @@ -16,7 +16,6 @@ const Jimp = require('jimp'); const fs = require('fs'); const _path = require('path'); -const { readManifest} = require('../../main.product'); /** * Find all image paths in png、jpg、bmp、jpeg format in the directory. * @param {String} imgPath The path of build folder. @@ -38,10 +37,6 @@ async function img2bin(imgPath) { const header = (image.bitmap.width << WIDTH_BIT_OFFSET) + (image.bitmap.height << HEIGHT_BIT_OFFSET); - process.env.aceManifestPath = process.env.aceManifestPath || path.resolve(process.env.projectPath, 'manifest.json'); - const manifest = readManifest(process.env.aceManifestPath) - const version = parseInt(manifest.minPlatformVersion); - let binFileOffset = 0; binView.setUint32(binFileOffset, COLOR_MODE, true); binFileOffset += 4; @@ -70,7 +65,7 @@ async function img2bin(imgPath) { binFileOffset += 1; }); - if (version <=6) { + if (process.env.PLATFORM_VERSION_version <=6) { const binPath1 = imgPath.replace(/(\.png|\.jpg|\.bmp|\.jpeg|\.BMP|\.JPG|\.PNG|\.JPEG)$/, '.bin'); fs.writeFileSync(binPath1, Buffer.from(binBuffer)); } diff --git a/ace-loader/webpack.lite.config.js b/ace-loader/webpack.lite.config.js index 1211a22..918b355 100644 --- a/ace-loader/webpack.lite.config.js +++ b/ace-loader/webpack.lite.config.js @@ -131,6 +131,7 @@ function setConfigs(env) { if (version <= 4) { process.env.PLATFORM_VERSION = PLATFORM.VERSION3; } + process.env.PLATFORM_VERSION_version = version; } module.exports = (env) => {