Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Webpack config for Rails
//= require main.bundle
window.React = require('react/addons')
window.Router = require('react-router')
// ...
/**
* @see http://webpack.github.io/docs/configuration.html for webpack configuration options
*/
module.exports = {
// 'context' sets the directory where webpack looks for module files you list in your 'require' statements
context: __dirname + '/app/assets/javascripts/webpack',
// 'entry' specifies the entry point, where webpack starts reading all
// dependencies listed and bundling them into the output file.
entry: './main.js',
// 'output' specifies the filepath for saving the bundled output generated by wepback.
// It is an object with options, and you can interpolate the name of the entry
// file using '[name]' in the filename.
// You will want to add the bundled filename to your '.gitignore'.
output: {
filename: '[name].bundle.js',
// We want to save the bundle in the same directory as the other JS.
path: __dirname + '/app/assets/javascripts',
},
// Enable source map support
devtool: "#eval-source-map",
module: {
loaders: [
{ test: /\.js$/, exclude: /node_modules/, loader: "6to5-loader"},
{ test: /\.coffee$/, loader: "coffee" }
]
},
resolve: {
extensions: ["", ".coffee", ".js"]
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment