Skip to content

Commit

Permalink
feat: implemented rollup for bundling (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlwn123 authored Sep 11, 2024
1 parent 9d2d350 commit d4c28a5
Show file tree
Hide file tree
Showing 3 changed files with 394 additions and 85 deletions.
8 changes: 7 additions & 1 deletion packages/core-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"directory": "packages/core-web"
},
"scripts": {
"build": "pnpm run clean && tsc --project tsconfig.json",
"build": "rollup --config",
"clean": "rm -rf dist tsconfig.tsbuildinfo",
"clean:deep": "pnpm run clean && rm -rf node_modules",
"typecheck": "tsc --noEmit"
Expand All @@ -23,7 +23,13 @@
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"devDependencies": {
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.6",
"@rollup/plugin-wasm": "^6.2.2",
"@types/node": "^20.14.8",
"@web/rollup-plugin-import-meta-assets": "^2.2.1",
"rollup": "^4.21.2",
"tslib": "^2.7.0",
"typescript": "^5.2.2"
}
}
29 changes: 29 additions & 0 deletions packages/core-web/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/** @type {import('rollup').RollupOptions} */
import typescript from '@rollup/plugin-typescript'
import { wasm } from '@rollup/plugin-wasm'
import { importMetaAssets } from '@web/rollup-plugin-import-meta-assets'
import terser from '@rollup/plugin-terser'

export default {
input: {
index: 'src/index.ts',
},
output: [
{
dir: 'dist',
format: 'esm',
sourcemap: true,
},
],
plugins: [
typescript({
sourceMap: true,
inlineSources: true,
}),
wasm({
maxFileSize: 0,
}),
importMetaAssets(),
terser(),
],
}
Loading

0 comments on commit d4c28a5

Please sign in to comment.