Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import babel from 'rollup-plugin-babel';
- import globals from 'rollup-plugin-node-globals';
- import commonjs from 'rollup-plugin-commonjs';
- import replace from 'rollup-plugin-replace';
- import resolve from 'rollup-plugin-node-resolve';
- import uglify from 'rollup-plugin-uglify';
- const config = {
- input: 'src/index.js',
- output: {
- file: 'build/bundle.js',
- format: 'iife'
- },
- plugins: [
- resolve({
- preferBuiltins: false,
- browser: true,
- jsnext: true
- }),
- commonjs({
- include: 'node_modules/**'
- }),
- babel({ babelrc: true }),
- globals(),
- replace({
- 'process.env.NODE_ENV': JSON.stringify('development')
- })
- ]
- };
- if (process.env.NODE_ENV == 'production') {
- config.output.file = 'build/bundle.min.js';
- config.plugins[3] = replace({ 'process.env.NODE_ENV': JSON.stringify('production') });
- config.plugins.push(
- uglify({
- compress: {
- pure_getters: true,
- unsafe: true,
- unsafe_comps: true,
- warnings: false
- }
- })
- );
- }
- export default config;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement