rollup redux



import nodeResolve from 'rollup-plugin-node-resolve' import babel from 'rollup-plugin-babel' import replace from 'rollup-plugin-replace' import { terser } from 'rollup-plugin-terser' import pkg from './package.json' export default [ // CommonJS { input: 'src/index.js', output: { file: 'lib/redux.js', format: 'cjs', indent: false }, external: [ ...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {}) ], plugins: [babel()] }, // ES { input: 'src/index.js', output: { file: 'es/redux.js', format: 'es', indent: false }, external: [ ...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {}) ], plugins: [babel()] }, // ES for Browsers { input: 'src/index.js', output: { file: 'es/redux.mjs', format: 'es', indent: false }, plugins: [ nodeResolve({ jsnext: true }), replace({ 'process.env.NODE_ENV': JSON.stringify('production') }), terser({ compress: { pure_getters: true, unsafe: true, unsafe_comps: true, warnings: false } }) ] }, // UMD Development { input: 'src/index.js', output: { file: 'dist/redux.js', format: 'umd', name: 'Redux', indent: false }, plugins: [ nodeResolve({ jsnext: true }), babel({ exclude: 'node_modules/**' }), replace({ 'process.env.NODE_ENV': JSON.stringify('development') }) ] }, // UMD Production { input: 'src/index.js', output: { file: 'dist/redux.min.js', format: 'umd', name: 'Redux', indent: false }, plugins: [ nodeResolve({ jsnext: true }), babel({ exclude: 'node_modules/**' }), replace({ 'process.env.NODE_ENV': JSON.stringify('production') }), terser({ compress: { pure_getters: true, unsafe: true, unsafe_comps: true, warnings: false } }) ] } ]
const { NODE_ENV } = process.env

module.exports = {
  presets: [
    [
      '@babel/env',
      {
        targets: {
          browsers: ['ie >= 11']
        },
        exclude: ['transform-async-to-generator', 'transform-regenerator'],
        modules: false,
        loose: true
      }
    ]
  ],
  plugins: [
    // don't use `loose` mode here - need to copy symbols when spreading
    '@babel/proposal-object-rest-spread',
    NODE_ENV === 'test' && '@babel/transform-modules-commonjs'
  ].filter(Boolean)
}

 

上一篇:关于WPF System.windows.Media.FontFamily 的类型初始值设定项引发异常问题解决方法


下一篇:GROUP BY你都不会!ROLLUP,CUBE,GROUPPING详解