-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.common.js
61 lines (58 loc) · 1.52 KB
/
webpack.config.common.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
const path = require('path')
const webpack = require('webpack')
// @todo We should use already defined in Grun paths heres
module.exports = (env = {}) => {
const isProduction = env.production // --env.production
const babelOptions = { cacheDirectory: true }
return {
target: 'web',
mode: isProduction ? 'production' : 'development',
devtool: isProduction ? 'source-map' : 'eval-source-map',
devServer: {
contentBase: './build',
overlay: true,
historyApiFallback: true,
watchContentBase: true,
watchOptions: {
ignored: [
// We need to way for `.prefixed.css`,
'**/*.compiled.css',
'**/*.map'
]
}
},
module: {
strictExportPresence: true,
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: [
{ loader: 'babel-loader', options: babelOptions },
'ts-loader',
'vue-jsx-hot-loader'
]
}, {
test: /\.m?jsx?$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: babelOptions
}
}
]
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
alias: {
'@data': path.resolve(__dirname, 'temp/data/scripts.js'),
'@files': path.resolve(__dirname, 'temp/data/files.json')
}
},
plugins: [
isProduction
? new webpack.HashedModuleIdsPlugin()
: new webpack.NamedModulesPlugin()
]
}
}