Skip to content

Instantly share code, notes, and snippets.

@sadeghbarati
Forked from emmiep/rollup.config.js
Created July 5, 2021 09:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sadeghbarati/ddccf619a271120e781f6c59cc17b120 to your computer and use it in GitHub Desktop.
Save sadeghbarati/ddccf619a271120e781f6c59cc17b120 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