11// inspired by https://justinribeiro.com/chronicle/2020/07/17/building-module-web-workers-for-cross-browser-compatibility-with-rollup/
22
3- import terser from '@rollup/plugin-terser' ;
4- import typescript from '@rollup/plugin-typescript' ;
5- import { defineConfig } from 'rollup' ;
3+ import { defineConfig } from 'rolldown' ;
64
75const config = defineConfig ( [
86 {
97 input : [ './src/index.ts' ] ,
108 treeshake : 'smallest' ,
9+ tsconfig : './tsconfig.build.json' ,
1110 output : {
1211 dir : './build/esm' ,
1312 format : 'esm' ,
13+ minify : true ,
1414 } ,
1515 external : [ './worker' ] ,
16- plugins : [
17- typescript ( { tsconfig : './tsconfig.json' , inlineSourceMap : false , sourceMap : false , inlineSources : false } ) ,
18- terser ( {
19- mangle : {
20- module : true ,
21- } ,
22- } ) ,
23- ] ,
2416 } ,
2517 {
2618 input : [ './src/_worker.ts' ] ,
19+ tsconfig : './tsconfig.build.json' ,
2720 output : {
2821 file : './build/esm/worker.ts' ,
2922 format : 'esm' ,
23+ minify : true ,
3024 } ,
3125 treeshake : 'smallest' ,
3226 plugins : [
33- typescript ( { tsconfig : './tsconfig.json' , inlineSourceMap : false , sourceMap : false , inlineSources : false } ) ,
34- terser ( {
35- mangle : {
36- module : true ,
37- } ,
38- } ) ,
3927 {
4028 name : 'worker-to-string' ,
4129 renderChunk ( code ) {
@@ -46,19 +34,13 @@ const config = defineConfig([
4634 } ,
4735 {
4836 input : [ './src/_worker.ts' ] ,
37+ tsconfig : './tsconfig.build.json' ,
4938 output : {
5039 file : './build/esm/worker-bundler.js' ,
5140 format : 'esm' ,
41+ minify : true ,
5242 } ,
5343 treeshake : 'smallest' ,
54- plugins : [
55- typescript ( { tsconfig : './tsconfig.json' , inlineSourceMap : false , sourceMap : false , inlineSources : false } ) ,
56- terser ( {
57- mangle : {
58- module : true ,
59- } ,
60- } ) ,
61- ] ,
6244 } ,
6345] ) ;
6446
0 commit comments