Skip to content

Commit

Permalink
1.2.6 Respect the license
Browse files Browse the repository at this point in the history
  • Loading branch information
bddjr committed Jan 10, 2025
1 parent dfc6c39 commit 5ab62f6
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 38 deletions.
21 changes: 5 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down Expand Up @@ -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",
Expand Down
8 changes: 5 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 0 additions & 10 deletions test/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 5ab62f6

Please sign in to comment.