Created
December 6, 2016 10:04
-
-
Save ali-master/938c52e2bb08b122a133923ed6227998 to your computer and use it in GitHub Desktop.
Webpack Config
This file contains hidden or 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
/** | |
* 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