-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a bundler to improve the compilation results
- Loading branch information
synw
committed
Dec 10, 2022
1 parent
4ddc760
commit d83f695
Showing
3 changed files
with
51 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
.DS_Store | ||
node_modules | ||
lib | ||
dist | ||
yarn.lock | ||
package-lock.json | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import resolve from '@rollup/plugin-node-resolve'; | ||
import commonjs from '@rollup/plugin-commonjs'; | ||
import typescript from '@rollup/plugin-typescript'; | ||
import { terser } from 'rollup-plugin-terser'; | ||
|
||
//const isProduction = !process.env.ROLLUP_WATCH; | ||
|
||
export default { | ||
input: 'src/index.ts', | ||
output: [ | ||
{ | ||
file: 'dist/index.cjs.min.js', | ||
format: 'cjs', | ||
plugins: [terser(),] | ||
}, | ||
{ | ||
file: 'dist/index.es.js', | ||
format: 'esm' | ||
}, | ||
{ | ||
file: 'dist/index.min.js', | ||
format: 'iife', | ||
name: '$instant', | ||
plugins: [terser()] | ||
}], | ||
plugins: [ | ||
typescript(), | ||
resolve({ | ||
jsnext: true, | ||
main: true, | ||
browser: true, | ||
}), | ||
commonjs(), | ||
//isProduction && terser({ format: { comments: false } }), | ||
], | ||
}; |