2020-08-25 10:22:29 +00:00
|
|
|
const { merge } = require('webpack-merge');
|
2017-03-31 18:21:41 +00:00
|
|
|
const webpack = require('webpack');
|
|
|
|
const commonConfig = require('./common.js');
|
|
|
|
|
|
|
|
module.exports = function () {
|
2020-08-25 10:22:29 +00:00
|
|
|
return merge(commonConfig(), {
|
2017-03-31 18:21:41 +00:00
|
|
|
devtool: 'eval-source-map',
|
|
|
|
output: {
|
2017-06-20 05:14:04 +00:00
|
|
|
filename: '[name].dev.js',
|
2017-03-31 18:21:41 +00:00
|
|
|
},
|
2020-08-25 10:22:29 +00:00
|
|
|
mode: 'development',
|
2017-03-31 18:21:41 +00:00
|
|
|
devServer: {
|
|
|
|
hot: true,
|
|
|
|
// enable HMR on the server
|
|
|
|
contentBase: './web',
|
|
|
|
// match the output path
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new webpack.HotModuleReplacementPlugin(),
|
|
|
|
],
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
enforce: 'pre',
|
|
|
|
test: /\.js$/,
|
|
|
|
loader: 'eslint-loader',
|
|
|
|
exclude: /node_modules/,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
exclude: /(node_modules)/,
|
|
|
|
use: {
|
|
|
|
loader: 'babel-loader',
|
|
|
|
options: {
|
2020-08-25 10:22:29 +00:00
|
|
|
presets: ['@babel/preset-env']
|
2017-06-20 05:14:04 +00:00
|
|
|
},
|
|
|
|
},
|
2017-03-31 18:21:41 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(s)?css$/,
|
|
|
|
use: [
|
|
|
|
'style-loader',
|
|
|
|
{
|
|
|
|
loader: 'css-loader',
|
|
|
|
options: {
|
|
|
|
importLoaders: 1,
|
2017-06-20 05:14:04 +00:00
|
|
|
},
|
2017-03-31 18:21:41 +00:00
|
|
|
},
|
2020-08-25 10:22:29 +00:00
|
|
|
{
|
|
|
|
loader: 'postcss-loader',
|
|
|
|
options: {
|
|
|
|
plugins: [require('autoprefixer')({})],
|
|
|
|
},
|
|
|
|
},
|
2017-06-20 05:14:04 +00:00
|
|
|
'sass-loader',
|
|
|
|
],
|
2017-03-31 18:21:41 +00:00
|
|
|
},
|
|
|
|
{
|
2017-10-15 22:07:12 +00:00
|
|
|
test: /\.(jpg|png|gif|svg|ico|eot|ttf|woff|woff2)$/,
|
2017-06-20 05:14:04 +00:00
|
|
|
use: 'url-loader',
|
2017-03-31 18:21:41 +00:00
|
|
|
},
|
2017-06-20 05:14:04 +00:00
|
|
|
],
|
2017-03-31 18:21:41 +00:00
|
|
|
},
|
2017-06-20 05:14:04 +00:00
|
|
|
});
|
2017-03-31 18:21:41 +00:00
|
|
|
};
|