Skip to content

Instantly share code, notes, and snippets.

@curiouslychase
Created May 31, 2015 02:37
Show Gist options
  • Save curiouslychase/63a1945271683baf4bad to your computer and use it in GitHub Desktop.
Save curiouslychase/63a1945271683baf4bad to your computer and use it in GitHub Desktop.
Sample webpack config
var path = require('path');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var webpack = require('webpack');
module.exports = {
resolve: {
modulesDirectories: ['node_modules', 'sass'],
extensions: ['', '.json', '.jsx', '.js']
},
entry: {
app: './src/js/entry.js'
},
output: {
path: __dirname + '/dist',
filename: '/js/bundle.js'
},
plugins: [
new webpack.ProvidePlugin({
React: 'react',
}),
new HtmlWebpackPlugin({ template: 'src/index.html' }),
new ExtractTextPlugin("css/[name].css"),
],
module: {
loaders: [
{ test: /\.(?:jsx|js)$/, loader: 'jsx-loader?insertPragma=React.DOM&harmony' },
{ test: /\.scss$/, loader: ExtractTextPlugin.extract('style', 'css-loader?sourceMap!sass?sourceMap')},
{ test: /\.json$/, loader: 'json-loader' }
]
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment