2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-05-15 11:59:37 +03:00
Files
bbob/rollup.config.js
T
Nikolay Kostyurin da6709d437 feat: update core deps (#120)
* feat: use swc.rs instead of babel

* BREAKING CHANGE: now we use swc.rs as main bundler and transpiler instead of babel
  - jest now uses swc
  - rollup now uses swc

* feat: benchmark now separate package with `npm start` and colored output
  - benchmark as separate package with error throw if package drops performance

* feat: all lerna packages now using scripts/pkg-task

* feat(github): publish to npm and github registry
  - when release was created this action automaticly publish packages to npm and github

* feat(github): move all from Travis CI to Github Actions
  - code analysis and tests now using github actions

* test: increase tests coverage
  - add more tests for @bbob/react, @bbob/vue2 and @bbob/parser
2021-11-29 00:33:06 +02:00

55 lines
1.1 KiB
JavaScript

import resolve from '@rollup/plugin-node-resolve';
import replace from '@rollup/plugin-replace';
import commonjs from '@rollup/plugin-commonjs';
import { terser } from 'rollup-plugin-terser';
const pkg = require(`${process.cwd()}/package.json`);
const { NODE_ENV } = process.env;
const baseConfig = {
input: 'es/index.js',
external: ['react', 'vue', 'prop-types'],
output: {
file: pkg.browser,
name: pkg.browserName,
format: 'umd',
exports: 'named',
globals: {
react: 'React',
vue: 'Vue',
'prop-types': 'PropTypes',
},
},
plugins: [
resolve(),
commonjs(),
replace({
preventAssignment: true,
'process.env.NODE_ENV': JSON.stringify(NODE_ENV),
}),
],
};
// only for dist
export default [
baseConfig,
{
...baseConfig,
output: {
...baseConfig.output,
file: pkg.browser.replace('.js', '.min.js'),
},
plugins: [
...baseConfig.plugins,
terser({
compress: {
pure_getters: true,
unsafe: true,
unsafe_comps: true,
warnings: false,
},
}),
],
},
];