diff --git a/README.md b/README.md index daa3f9f..af0db25 100644 --- a/README.md +++ b/README.md @@ -26,19 +26,8 @@ export default defineConfig({ singleFileCompression(), ], - // Not required options: - esbuild: { - // Remove license comments, make file smaller. - legalComments: "none" - }, build: { - terserOptions: { - format: { - // Remove license comments, make file smaller. - comments: false - } - }, - // Not use old syntax, make file smaller. + // Not use old syntax, make file smaller. target: 'esnext', // Disable reporting compressed chunk sizes, slightly improve build speed. reportCompressedSize: false @@ -106,15 +95,15 @@ vite v6.0.7 building for production... ✓ 45 modules transformed. rendering chunks (1)... -vite-plugin-singlefile-compression 1.2.5 building... +vite-plugin-singlefile-compression 1.2.6 building... file:///D:/bddjr/Desktop/code/js/vite-plugin-singlefile-compression/test/dist/index.html - 101.02 KiB -> 46.52 KiB + 101.56 KiB -> 46.84 KiB Finish. -dist/index.html 47.64 kB -✓ built in 716ms +dist/index.html 47.96 kB +✓ built in 686ms ``` ## Clone diff --git a/package-lock.json b/package-lock.json index 1bca09a..952b757 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,17 +1,17 @@ { "name": "vite-plugin-singlefile-compression", - "version": "1.2.5", + "version": "1.2.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "vite-plugin-singlefile-compression", - "version": "1.2.5", + "version": "1.2.6", "license": "MIT", "dependencies": { "@types/html-minifier-terser": "^7.0.2", "@types/node": "^22.9.3", - "base128-ascii": "^2.0.2", + "base128-ascii": "^2.0.3", "esbuild": "^0.24.0", "html-minifier-terser": "^7.2.0", "mime": "^4.0.4", @@ -808,10 +808,10 @@ "license": "MIT" }, "node_modules/base128-ascii": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/base128-ascii/-/base128-ascii-2.0.2.tgz", - "integrity": "sha512-ZMXMKz8GtFbvIGBRQbTzvy3O8ExGTc6N79T2dqRGERKQwGl9Xga1PBSL3VpD2Q3Im5jDWwrJjmiWoJfddpUpOw==", - "license": "MIT", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/base128-ascii/-/base128-ascii-2.0.3.tgz", + "integrity": "sha512-LLFSKXteInKu9bDZNyqlAMJbEdWGYWZXnWChww7EHztB0fOJXImuFRaSh7xGhhFdBOKLR51UlFjSZMZsFX0tBw==", + "license": "Unlicense", "dependencies": { "@types/node": "^22.10.5", "rimraf": "^6.0.1", diff --git a/package.json b/package.json index f04bcb4..f5491c2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vite-plugin-singlefile-compression", - "version": "1.2.5", + "version": "1.2.6", "main": "dist/index.js", "typings": "dist/index.d.ts", "files": [ @@ -42,7 +42,7 @@ "dependencies": { "@types/html-minifier-terser": "^7.0.2", "@types/node": "^22.9.3", - "base128-ascii": "^2.0.2", + "base128-ascii": "^2.0.3", "esbuild": "^0.24.0", "html-minifier-terser": "^7.2.0", "mime": "^4.0.4", diff --git a/src/index.ts b/src/index.ts index 37a176b..52ec648 100644 --- a/src/index.ts +++ b/src/index.ts @@ -358,9 +358,11 @@ async function generateBundle(bundle: OutputBundle, config: ResolvedConfig, opti // fill script newHtml = newHtml.split('self.__vitePluginSinglefileCompression=1', 2).join( - options.useBase128 - ? templateBase128.join(gzipToBase128(newJSCode.toString())) - : template.join(gzipToBase64(newJSCode.toString())) + '/*vite-plugin-singlefile-compression*/' + ( + options.useBase128 + ? templateBase128.join(gzipToBase128(newJSCode.toString())) + : template.join(gzipToBase64(newJSCode.toString())) + ) ) // finish diff --git a/test/vite.config.ts b/test/vite.config.ts index 979990b..cf70cea 100644 --- a/test/vite.config.ts +++ b/test/vite.config.ts @@ -15,17 +15,7 @@ export default defineConfig({ // Add singleFileCompression singleFileCompression(), ], - esbuild: { - // Remove license comments, make file smaller. - legalComments: "none" - }, build: { - terserOptions: { - format: { - // Remove license comments, make file smaller. - comments: false - } - }, // Not use old syntax, make file smaller. target: 'esnext', // Disable reporting compressed chunk sizes, slightly improve build speed.