Skip to content

Instantly share code, notes, and snippets.

@muraray
Last active October 8, 2018 07:03
Show Gist options
  • Save muraray/b699c85aa809ba974e2c89bca47d5fcb to your computer and use it in GitHub Desktop.
Save muraray/b699c85aa809ba974e2c89bca47d5fcb to your computer and use it in GitHub Desktop.
React Rollup Bootstrap
{
"presets": [ "es2015-rollup", "react" ],
"plugins": [ "external-helpers", "transform-decorators-legacy" ]
}
# Installing Babel and Rollup
```bash
npm i -g babel-cli rollup
```
# Now install everything by running:
```bash
npm i
```
# Building Your project with Rollup
```bash
rollup -c
```
{
"author": "My Name",
"name": "myProject",
"version": "0.0.0",
"devDependencies": {
"babel-cli": "^6.18.0",
"babel-plugin-external-helpers": "^6.18.0",
"babel-plugin-syntax-decorators": "^6.13.0",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-es2015-rollup": "^3.0.0",
"babel-preset-react": "^6.16.0",
"babel-preset-stage-0": "^6.16.0",
"react": "^15.0.2",
"react-dom": "^15.0.2",
"rollup-plugin-babel": "^2.7.1",
"rollup-plugin-commonjs": "^5.0.5",
"rollup-plugin-node-resolve": "^2.0.0",
"rollup-plugin-replace": "^1.1.1",
"rollup-plugin-uglify": "^1.0.1"
},
"dependencies": {}
}
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs'
import nodeResolve from 'rollup-plugin-node-resolve'
import uglify from 'rollup-plugin-uglify'
import replace from 'rollup-plugin-replace'
var productionConfig =
{
entry: 'src/index.js',
dest: 'dist/bundle.js',
format: 'iife',
plugins:
[
babel({
exclude: 'node_modules/**'
}),
nodeResolve({
jsnext: true
}),
commonjs({
include: 'node_modules/**',
namedExports:
{
'./node_modules/react/react.js':
[ 'cloneElement', 'createElement', 'PropTypes',
'Children', 'Component' ],
}
}),
replace({
'process.env.NODE_ENV': JSON.stringify( 'production' )
}),
uglify({
compress: {
screw_ie8: true,
warnings: false
},
output: {
comments: false
},
sourceMap: false
})
]
}
var developmentConfig =
{
entry: 'src/index.js',
dest: 'dist/bundle.js',
format: 'iife',
plugins:
[
babel({
exclude: 'node_modules/**'
}),
nodeResolve({
jsnext: true
}),
commonjs({
include: 'node_modules/**',
namedExports:
{
'./node_modules/react/react.js':
[ 'cloneElement', 'createElement', 'PropTypes',
'Children', 'Component' ],
}
}),
replace({
'process.env.NODE_ENV': JSON.stringify( 'development' )
})
]
}
export default developmentConfig;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment