1 |
|
2 |
|
3 |
|
4 |
|
5 | const webpack = require('webpack')
|
6 | const path = require('path')
|
7 | const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
|
8 | const config = require('./webpack.config.base')('dev')
|
9 | const appConfig = require(path.join(process.cwd(), 'app.config'))
|
10 | require('./cp-files')(appConfig.enableCordova, 'dev')
|
11 |
|
12 |
|
13 | config.devtool = '#cheap-module-source-map'
|
14 |
|
15 |
|
16 | Object.keys(config.entry).forEach(function (name) {
|
17 | config.entry[name] = ['webpack-hot-middleware/client?path=/__webpack_hmr&timeout=2000&reload=true'].concat(config.entry[name])
|
18 | })
|
19 |
|
20 | config.mode = 'development'
|
21 |
|
22 | config.module.rules.push(
|
23 | {
|
24 | test: /\.css$/,
|
25 | use: ['vue-style-loader', 'css-loader',
|
26 | {
|
27 | loader: 'postcss-loader', options: !appConfig.postcssNodeModules ? { exclude: /node_modules/ } : {}
|
28 | }],
|
29 | },
|
30 | {
|
31 | test: /\.less$/,
|
32 | use: ['vue-style-loader', 'css-loader', 'postcss-loader',
|
33 | { loader: 'less-loader', options: { sourceMap: false } },
|
34 | ],
|
35 | }
|
36 | )
|
37 | config.plugins = (config.plugins || []).concat([
|
38 |
|
39 | new webpack.NamedModulesPlugin(),
|
40 | new webpack.HotModuleReplacementPlugin(),
|
41 | new FriendlyErrorsPlugin(),
|
42 | ])
|
43 |
|
44 | module.exports = config
|