Skip to content

Instantly share code, notes, and snippets.

@ali-master
Created December 6, 2016 10:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ali-master/938c52e2bb08b122a133923ed6227998 to your computer and use it in GitHub Desktop.
Save ali-master/938c52e2bb08b122a133923ed6227998 to your computer and use it in GitHub Desktop.
Webpack Config
/**
* npm install --save-dev webpack babel-loader babel-core babel-preset-{es2015,react} style-loader css-loader sass-loader
* npm install --save react react-dom
* directory folders: static, public
*/
const path = require("path");
const webpack = require("webpack");
module.exports = {
devtool: "source-map",
entry: {
app: "./static/app.js"
},
output: {
pathInfo: true,
path: "./public/",
publicPath: "/",
filename: "[name].js",
sourceMapFilename: "[file].map"
},
stats: {
colors: true,
reasons: true
},
module: {
loaders: [
{
test: /\.jsx?$/,
loader: 'babel',
execlude: /node_modules|bower_components/
},
{
test: /\.css$/,
loader: "style!css?modules&localIdentName=[name]-[local]--[hash:base64:5]"
},
{
test: /\.scss$/,
loaders: ["style!sourceMap", "css?modules&importLoaders=1&localIdentName=[name]--[local]", "sass?sourceMap"],
execlude: /node_modules|bower_components/
}
]
},
resolve: {
extension: ["" ,".webpack.js", ".js", ".jsx", ".scss", ".css"]
},
plugins: [
new webpack.NoErrorsPlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment