Last active
May 31, 2016 15:14
-
-
Save reharik/8a63035380d13bb9e8b2145c48b6b946 to your computer and use it in GitHub Desktop.
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
var path = require('path'); | |
var webpack = require('webpack'); | |
var HtmlWebpackPlugin = require('html-webpack-plugin'); | |
var node_modules = __dirname + '/node_modules'; | |
const config = { | |
// Gives you sourcemaps without slowing down rebundling | |
devtool : 'cheap-module-eval-source-map', | |
resolve: { alias: {} }, | |
entry : path.join(__dirname, 'example/index.js'), | |
output : { | |
path : path.join(__dirname, '/dist/'), | |
filename : 'bundle.js', | |
publicPath: '/' | |
}, | |
module : { | |
noParse:[], | |
loaders: [ | |
{ test : /\.jsx?$/, exclude: /node_modules/, loader : 'babel-loader' }, | |
{ test: /\.css$/, loader: 'style-loader!css-loader?sourceMap' }, | |
{ test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file" }, | |
{ test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/octet-stream" }, | |
{ test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=image/svg+xml" }, | |
{ test: /\.png$/, loader: "url-loader", query: { mimetype: "image/png" } }, | |
{ test: /\.jpg$/, loader: "url-loader", query: { mimetype: "image/jpg" } }, | |
{ test: /\.gif$/, loader: "url-loader", query: { mimetype: "image/gif" } }, | |
{ test: /\.scss$/, loaders: ["style", "css?sourceMap", "sass?sourceMap"] }, | |
{ test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loaders: ['url-loader?limit=10000&mimetype=application/font-woff' ] } | |
] | |
}, | |
plugins: [ | |
new HtmlWebpackPlugin({ | |
template: __dirname + "/example/index.tmpl.html" | |
}), | |
new webpack.optimize.OccurenceOrderPlugin(), | |
new webpack.HotModuleReplacementPlugin(), | |
new webpack.NoErrorsPlugin() | |
], | |
devServer: { | |
contentBase : "./dist", | |
colors : true, | |
historyApiFallback: true, | |
inline : true, | |
hot : true | |
}, | |
sassLoader: { | |
includePaths: [path.resolve(__dirname, "./sass")] | |
} | |
}; | |
module.exports = config; | |
-------------- | |
{ | |
"presets": [ | |
"es2015", | |
"react", | |
"stage-0" | |
], | |
"env": { | |
"development": { | |
"plugins": [ | |
[ | |
"react-transform", | |
{ | |
"transforms": [ | |
{ | |
"transform": "react-transform-hmr", | |
// if you use React Native, pass "react-native" instead: | |
"imports": [ | |
"react" | |
], | |
// this is important for Webpack HMR: | |
"locals": [ | |
"module" | |
] | |
} | |
] | |
// note: you can put more transforms into array | |
// this is just one of them! | |
} | |
] | |
] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment