Created
February 2, 2015 18:45
-
-
Save kulesa/ba49c3bb8baf4d2c9812 to your computer and use it in GitHub Desktop.
Webpack config for Rails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//= require main.bundle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.React = require('react/addons') | |
window.Router = require('react-router') | |
// ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @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