Skip to content

Commit

Permalink
Trim down the published package so JSDelivr will work again
Browse files Browse the repository at this point in the history
(re: #1561)

- No sourcemaps for legacy builds
- Exclude `dist/data/modules`

This returns the package back to a reasonable size.
`npm publish --dry-run` results in:
  npm notice package size: 24.5 MB
  npm notice unpacked size: 94.8 MB

We can figure out another way to publish a package that includes everything
re: #1482
  • Loading branch information
bhousel committed Sep 16, 2024
1 parent 9b5a7f3 commit 8e31ab4
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions config/esbuild.config.legacy-min.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ esbuild
.build({
minify: true,
bundle: true,
sourcemap: true,
sourcemap: false,
entryPoints: ['./modules/main.js'],
legalComments: 'none',
logLevel: 'info',
outfile: 'dist/rapid.legacy.min.js',
target: 'es2016',
target: 'es2016'
})
.catch(() => process.exit(1));
5 changes: 3 additions & 2 deletions config/esbuild.config.legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import esbuild from 'esbuild';

esbuild
.build({
minify: false,
bundle: true,
sourcemap: true,
sourcemap: false,
entryPoints: ['./modules/main.js'],
legalComments: 'none',
logLevel: 'info',
outfile: 'dist/rapid.legacy.js',
target: 'es2016',
target: 'es2016'
})
.catch(() => process.exit(1));
3 changes: 2 additions & 1 deletion config/esbuild.config.modern-min.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ esbuild
.build({
minify: true,
bundle: true,
sourcemap: true,
sourcemap: false,
entryPoints: ['./modules/main.js'],
legalComments: 'none',
logLevel: 'info',
outfile: 'dist/rapid.min.js',
target: 'esnext'
})
.catch(() => process.exit(1));
4 changes: 3 additions & 1 deletion config/esbuild.config.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import fs from 'node:fs';

esbuild
.build({
minify: false,
bundle: true,
sourcemap: true,
metafile: true,
entryPoints: ['./modules/main.js'],
legalComments: 'none',
logLevel: 'info',
metafile: true,
outfile: 'dist/rapid.js',
target: 'esnext'
})
.then(result => {
fs.writeFileSync('./dist/esbuild.json', JSON.stringify(result.metafile, null, 2));
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
"license": "ISC",
"type": "module",
"main": "dist/rapid.min.js",
"files": [ "dist/" ],
"files": [
"dist",
"!dist/data/modules"
],
"scripts": {
"all": "run-s clean build dist",
"benchmark": "run-p start:server test:benchmark",
Expand Down

0 comments on commit 8e31ab4

Please sign in to comment.