Skip to content

Instantly share code, notes, and snippets.

@wearhere
Created December 3, 2017 05:23
Show Gist options
  • Save wearhere/132a45310c2b5c6a2dacfad467fc814e to your computer and use it in GitHub Desktop.
Save wearhere/132a45310c2b5c6a2dacfad467fc814e to your computer and use it in GitHub Desktop.
Minimal Babel setup for use with React "hello world". External dependencies purposefully not handled—see https://mixmax.com/blog/rollup-externals for solutions.
import React from 'react';
import ReactDOM from 'react-dom';
ReactDOM.render(
<h1>Hello, world!</h1>,
document.getElementById('root')
);
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "rollup -c"
},
"author": "",
"license": "MIT",
"devDependencies": {
"babel-core": "^6.26.0",
"babel-preset-react": "^6.24.1",
"rollup": "^0.52.0",
"rollup-plugin-babel": "^3.0.2"
}
}
import babel from 'rollup-plugin-babel';
export default {
input: 'main.js',
output: {
file: 'bundle.js',
format: 'iife'
},
plugins: [
babel({
presets: ['react']
})
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment