-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dev.js
41 lines (39 loc) · 1.2 KB
/
webpack.dev.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const { merge } = require('webpack-merge')
const fs = require('fs')
const webpack = require('webpack')
let baseConfig
// check if we have a webpack.config in project root
try {
fs.accessSync(`${process.env.PROJECT_CWD}/webpack.config.js`, fs.constants.R_OK | fs.constants.W_OK)
const getConfigPath = () => `${process.env.PROJECT_CWD}/webpack.config.js`
baseConfig = require(getConfigPath())
console.log('✳️ using local webpack.config!')
} catch (err) {
const getConfigPath = () => `${process.env.PWD}/webpack.config.js`
baseConfig = require(getConfigPath())
console.log('⚛︎ using Taskrunner webpack.config!')
}
module.exports = merge(baseConfig, {
mode: 'development',
plugins: [
new webpack.EnvironmentPlugin({
NODE_ENV: 'development' // use 'development' unless process.env.NODE_ENV is defined
}),
],
stats: {
assets: false,
cached: false,
cachedAssets: false,
entrypoints: false,
hash: false,
children: true,
reasons: false,
version: false,
outputPath: false,
chunkOrigins: false,
colors: true,
errorDetails: true
},
// https://webpack.js.org/configuration/devtool/ for other options
devtool: 'eval-cheap-source-map',
})