Created
September 16, 2014 19:16
-
-
Save justin808/9ced59d3dd3f50d3e5be to your computer and use it in GitHub Desktop.
Sample file for testing webpack bundled assets when used in the context of Rails. See https://github.com/justin808/react-webpack-rails-tutorial for more details.
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
var webpack = require("webpack"); | |
var path = require("path"); | |
module.exports = { | |
devtool: "source-map", | |
context: __dirname, // + "/../app/assets/javascripts", | |
entry: [ | |
"webpack-dev-server/client?http://localhost:3000", | |
"webpack/hot/dev-server", | |
"./scripts/webpack_only", | |
"./assets/javascripts/example" | |
], | |
// Note, this file is not actually saved, but used by the express server | |
output: { | |
filename: "express-bundle.js", | |
path: __dirname | |
}, | |
plugins: [ | |
new webpack.HotModuleReplacementPlugin() | |
], | |
// Let's load jQuery from the CDN | |
externals: { | |
jquery: "var jQuery" | |
}, | |
resolve: { | |
root: [ path.join(__dirname, "scripts"), path.join(__dirname, "assets/javascripts"), | |
path.join(__dirname, "assets/stylesheets") ], | |
extensions: ["", ".webpack.js", ".web.js", ".js", ".jsx", ".scss", ".css", "config.js"] | |
}, | |
module: { | |
loaders: [ | |
{ test: require.resolve("react"), loader: "expose?React" }, | |
{ test: /\.jsx$/, loaders: ["react-hot", "es6", "jsx?harmony"] }, | |
{ test: /\.css$/, loader: "style-loader!css-loader" }, | |
{ test: /\.scss$/, loader: "style!css!sass?outputStyle=expanded&imagePath=/assets/images"} | |
] | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment