一覧へ戻る
pschroen/rollup-plugin-bundleutils(新しいタブで開きます)
主要言語: JavaScript
A set of functions commonly used after tree shaking
- star 数
- 14
- watcher 数
- 1
- fork 数
- 0
- issue 数
- 0
- 最終更新
- 2023/11/28
主要言語: JavaScript
A set of functions commonly used after tree shaking
A set of functions commonly used after tree shaking.
npm i -D rollup-plugin-bundleutils
# or
yarn add -D rollup-plugin-bundleutils// rollup.config.js import { timestamp, regex, babel, terser } from 'rollup-plugin-bundleutils'; export default { // ... plugins: [ regex([ [/^import\s.*[\r\n]+/gm, ''] ]), babel({ compact: false, plugins: ['@babel/plugin-proposal-class-properties'] }), terser({ output: { preamble: `// ${timestamp()}` } }) ] };
import { timestamp } from 'rollup-plugin-bundleutils'; console.log(timestamp()); // 2017-09-19 4:55pm
JavaScript String replace after tree shaking. Expects an Array of regexp|substr, newSubstr|function pairs.
// rollup.config.js import { regex } from 'rollup-plugin-bundleutils'; export default { input: 'src/main.js', output: { file: 'public/bundle.js', format: 'es' }, plugins: [ regex([ [/^[\r\n]+export\s.*/gm, ''] ]) ] };
Transpile bundle after tree shaking.
// rollup.config.js import { babel } from 'rollup-plugin-bundleutils'; export default { input: 'src/main.js', output: { file: 'public/bundle.js', format: 'iife' }, plugins: [ babel({ // Default presets: [ ['@babel/preset-env', { modules: false }] ] }) ] };
Minify bundle after tree shaking.
// rollup.config.js import { terser } from 'rollup-plugin-bundleutils'; export default { input: 'src/main.js', output: { file: 'public/bundle.js', format: 'iife' }, plugins: [ terser() ] };