Skip to content

Commit 5efb1f0

Browse files
committed
add module.min
1 parent 023174b commit 5efb1f0

File tree

3 files changed

+180
-3
lines changed

3 files changed

+180
-3
lines changed

package-lock.json

+145
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
"test": "test"
1212
},
1313
"scripts": {
14-
"build": "npm run build-min",
15-
"build-normal": "rollup -c && tsc --emitDeclarationOnly --declaration",
16-
"build-min": "npm run build-normal && google-closure-compiler --warning_level=VERBOSE --jscomp_off=globalThis --jscomp_off=checkTypes --externs build/externs.js --language_in=ECMASCRIPT_2019 --language_out=ECMASCRIPT_2019 --js dist/2.x/wgpu-matrix.js --js_output_file dist/2.x/wgpu-matrix.min.js && node ./build/tools/append-banner.js dist/2.x/wgpu-matrix.min.js",
14+
"build": "rollup -c && tsc --emitDeclarationOnly --declaration",
1715
"build-ci": "npm run pre-push && node build/tools/prep-for-deploy.js",
1816
"check": "npm run lint",
1917
"check-ci": "npm run pre-push",
@@ -48,6 +46,7 @@
4846
},
4947
"homepage": "https://github.com/greggman/wgpu-matrix#readme",
5048
"devDependencies": {
49+
"@rollup/plugin-terser": "^0.4.4",
5150
"@rollup/plugin-typescript": "^11.1.6",
5251
"@tsconfig/recommended": "^1.0.6",
5352
"@typescript-eslint/eslint-plugin": "^5.62.0",

rollup.config.js

+33
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import typescript from '@rollup/plugin-typescript';
2+
import terser from '@rollup/plugin-terser';
23
import fs from 'fs';
34

45
const pkg = JSON.parse(fs.readFileSync('package.json', {encoding: 'utf8'}));
@@ -9,6 +10,11 @@ const plugins = [
910
typescript({ tsconfig: './tsconfig.json' }),
1011
];
1112

13+
const minPlugins = [
14+
...plugins,
15+
terser(),
16+
];
17+
1218
export default [
1319
{
1420
input: 'src/wgpu-matrix.ts',
@@ -37,4 +43,31 @@ export default [
3743
],
3844
plugins,
3945
},
46+
{
47+
input: 'src/wgpu-matrix.ts',
48+
output: [
49+
{
50+
file: `dist/${ver}/wgpu-matrix.module.min.js`,
51+
format: 'esm',
52+
sourcemap: true,
53+
banner,
54+
freeze: false,
55+
},
56+
],
57+
plugins: minPlugins,
58+
},
59+
{
60+
input: 'src/wgpu-matrix.ts',
61+
output: [
62+
{
63+
name: 'wgpuMatrix',
64+
file: `dist/${ver}/wgpu-matrix.min.js`,
65+
format: 'umd',
66+
sourcemap: true,
67+
banner,
68+
freeze: false,
69+
},
70+
],
71+
plugins: minPlugins,
72+
},
4073
];

0 commit comments

Comments
 (0)