Skip to content

Instantly share code, notes, and snippets.

@caalberts
Last active January 10, 2020 16:11
Show Gist options
  • Save caalberts/3aa2db79756bc4886519ce620901306d to your computer and use it in GitHub Desktop.
Save caalberts/3aa2db79756bc4886519ce620901306d to your computer and use it in GitHub Desktop.
React + Webpack + Rails
{
"presets": ["es2015", "react"]
}
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require_tree .
<div id="react"></div>
{
"dependencies": {
"babel-core": "^6.10.4",
"babel-loader": "^6.2.4",
"babel-preset-es2015": "^6.9.0",
"babel-preset-react": "^6.11.1",
"events": "^1.1.1",
"flux": "^2.1.1",
"react": "^15.2.1",
"react-dom": "^15.2.1",
"react-router": "^2.6.0",
"webpack": "^1.13.1"
}
}
module.exports = {
entry: "./app/assets/react/main.jsx",
output: {
path: __dirname + "/app/assets/javascripts",
filename: "bundle.js"
},
resolve: {
extensions: ['', '.js', '.jsx']
},
module: {
loaders: [
{ test: /\.jsx$/, loader: 'babel-loader' }
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment