2017-07-15 14:52:09 +00:00
|
|
|
const { resolve, join } = require('path')
|
|
|
|
const webpack = require('webpack')
|
2018-07-25 19:04:10 +00:00
|
|
|
const ManifestPlugin = require('webpack-manifest-plugin');
|
2017-04-07 19:57:56 +00:00
|
|
|
|
2017-07-15 14:52:09 +00:00
|
|
|
const config = {
|
2018-05-10 08:48:39 +00:00
|
|
|
mode: 'development',
|
2017-07-15 14:52:09 +00:00
|
|
|
devtool: 'cheap-eval-source-map',
|
|
|
|
context: resolve(__dirname, 'src'),
|
|
|
|
entry: {
|
2018-07-25 19:04:10 +00:00
|
|
|
bundle: [
|
2017-07-15 14:52:09 +00:00
|
|
|
'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/'
|
|
|
|
},
|
|
|
|
{
|
2018-05-04 17:34:25 +00:00
|
|
|
test: /\.scss$/,
|
2017-07-15 14:52:09 +00:00
|
|
|
use: [
|
2018-05-04 17:34:25 +00:00
|
|
|
{
|
|
|
|
loader: "style-loader"
|
|
|
|
},
|
2017-07-15 14:52:09 +00:00
|
|
|
{
|
|
|
|
loader: 'css-loader',
|
|
|
|
options: {
|
|
|
|
modules: true,
|
2018-05-04 17:34:25 +00:00
|
|
|
importLoaders: 2,
|
2017-07-15 14:52:09 +00:00
|
|
|
localIdentName: '[name]__[local]___[hash:base64:5]'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2018-05-04 17:34:25 +00:00
|
|
|
loader: "postcss-loader"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
loader: "sass-loader"
|
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(),
|
2018-07-25 19:04:10 +00:00
|
|
|
new webpack.NamedModulesPlugin(),
|
|
|
|
new ManifestPlugin({'writeToFileEmit': true})
|
2017-07-15 14:52:09 +00:00
|
|
|
]
|
2017-04-07 19:57:56 +00:00
|
|
|
}
|
2017-07-15 14:52:09 +00:00
|
|
|
module.exports = config
|