Skip to content

Instantly share code, notes, and snippets.

@emmiep
Created April 18, 2018 16:28
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save emmiep/8fb5a2887a8ec007b319f0abff04ffb1 to your computer and use it in GitHub Desktop.
Save emmiep/8fb5a2887a8ec007b319f0abff04ffb1 to your computer and use it in GitHub Desktop.
Rollup manual chunks for vendor bundle
import babel from 'rollup-plugin-babel';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import replace from 'rollup-plugin-replace';
const env = process.env.NODE_ENV || 'development';
export default {
input: [
'src/index.js'
],
output: {
dir: 'build/js',
format: 'system',
name: 'app',
sourcemap: true,
},
manualChunks: {
'vendor': [
'node_modules/react/index.js',
'node_modules/react-dom/index.js'
]
},
experimentalCodeSplitting: true,
plugins: [
babel({
exclude: 'node_modules/**'
}),
resolve(),
commonjs(),
replace({
'process.env.NODE_ENV': JSON.stringify(env)
})
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment