namesny-com/webpack.config.js

76 lines
1.6 KiB
JavaScript
Raw Normal View History

2017-07-15 14:52:09 +00:00
const { resolve, join } = require('path')
const webpack = require('webpack')
2017-04-07 19:57:56 +00:00
2017-07-15 14:52:09 +00:00
const config = {
devtool: 'cheap-eval-source-map',
context: resolve(__dirname, 'src'),
entry: {
home: [
'webpack-hot-middleware/client',
'./app-client.js'
]
},
2017-04-07 19:57:56 +00:00
output: {
2017-07-15 14:52:09 +00:00
path: resolve(__dirname,'public/static'),
filename: 'bundle.js',
publicPath: '/static/'
2017-04-07 19:57:56 +00:00
},
module: {
2017-07-15 14:52:09 +00:00
rules: [
{
test: /\.js$/,
use: [
'babel-loader'
],
exclude: '/node_modules/'
},
{
test: /\.css$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
modules: true,
importLoaders: 1,
localIdentName: '[name]__[local]___[hash:base64:5]'
}
},
{
loader: 'postcss-loader'
}
]
},
2017-04-07 19:57:56 +00:00
{test: /\.scss$/,
use: [{
loader: "style-loader" // creates style nodes from JS strings
}, {
loader: "css-loader" // translates CSS into CommonJS
}, {
loader: "sass-loader" // compiles Sass to CSS
}]
2017-07-15 14:52:09 +00:00
},
{
2017-12-29 18:41:24 +00:00
test: /\.(png|jpg)$/,
2017-07-15 14:52:09 +00:00
exclude: /node_modules/,
loader: 'url-loader'
},
2017-12-29 18:41:24 +00:00
{
test: /\.(html)$/,
use: {
loader: 'html-loader',
options: {
attrs: [':data-src']
}
}
},
2017-04-07 19:57:56 +00:00
]
},
2017-07-15 14:52:09 +00:00
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.NamedModulesPlugin()
]
2017-04-07 19:57:56 +00:00
}
2017-07-15 14:52:09 +00:00
module.exports = config