kana/webpack.config.js

57 lines
1.6 KiB
JavaScript
Raw Normal View History

2016-07-28 17:56:13 +00:00
const webpack = require('webpack');
const fs = require('fs');
const path = require('path');
const autoprefixer = require('autoprefixer');
const precss = require('precss');
const HtmlWebPackPlugin = require('html-webpack-plugin');
2016-07-27 17:13:08 +00:00
module.exports = {
entry: [
'webpack-dev-server/client?http://localhost:8080',
'webpack/hot/only-dev-server', // "only" prevents reload on syntax errors
'./src/index'
],
output: {
path: path.resolve(__dirname, './dist'),
publicPath: '/',
filename: 'bundle.js'
},
resolve: {
2017-03-18 12:58:55 +00:00
extensions: ['.js', '.jsx']
2016-07-27 17:13:08 +00:00
},
plugins: [
new HtmlWebPackPlugin({
template: 'src/index.html',
2017-03-18 12:58:55 +00:00
filename: './index.html'
2016-07-27 17:13:08 +00:00
}),
new webpack.HotModuleReplacementPlugin(),
2017-03-18 12:58:55 +00:00
new webpack.LoaderOptionsPlugin({
options: {
postcss: function() {
return [autoprefixer, precss];
}
}
})
2016-07-27 17:13:08 +00:00
],
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
2017-03-18 12:58:55 +00:00
loaders: ['react-hot-loader', 'babel-loader']
2016-07-27 17:13:08 +00:00
}, {
test: /\.scss$/,
loaders: ['style-loader', 'css-loader', 'postcss-loader']
}, {
test: /\.css$/,
loaders: ['style-loader', 'css-loader']
2017-03-18 12:58:55 +00:00
}, {
2016-07-28 17:56:13 +00:00
test: /\.(png|jpg|svg|woff|woff2)?(\?v=\d+.\d+.\d+)?$/,
2016-07-27 17:13:08 +00:00
loader: 'url-loader?limit=25000'
2017-03-18 12:58:55 +00:00
}, {
2016-07-28 17:56:13 +00:00
test: /\.(eot|ttf)$/,
2016-07-27 17:13:08 +00:00
loader: 'file-loader'
}
]
}
};