forked from networkteam/nwt-frontend-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.test.js
89 lines (86 loc) · 2.63 KB
/
webpack.test.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
const merge = require('webpack-merge');
const common = require('./webpack.common.js');
const path = require('path');
const ExtraWatchWebpackPlugin = require('extra-watch-webpack-plugin');
module.exports = function(env, args) {
const basePackageName = args['basePackage'];
const basePackagePathAbsolute = () => path.resolve(process.cwd(), `../${basePackageName}`);
return merge(common(env, args), {
// CSS loaders need inline source maps to work correctly
devtool: 'eval-source-map',
mode: 'development',
target: 'node',
module: {
rules: [
{
test: /\.js?$/,
include: [
path.resolve('./Resources/Private/Javascript'),
path.resolve(`${basePackagePathAbsolute()}/Resources/Private/Javascript`),
],
exclude: /node_modules/,
loader: require.resolve('babel-loader'),
options: {
"presets": [
[
require.resolve("@babel/preset-env"),
{
"targets": {
"browsers": [
"> 1%",
"last 2 versions",
"IE 11",
"Safari >= 10",
"not IE < 11",
"not ExplorerMobile < 11"
]
},
"modules": false
}
],
require.resolve("@babel/preset-react")
],
"plugins": [
[require.resolve("@babel/plugin-proposal-decorators"), {"legacy": true}],
require.resolve("@babel/plugin-proposal-class-properties"),
require.resolve("@babel/plugin-proposal-object-rest-spread")
]
}
},
{
test: /\.(js?$)/,
exclude: /node_modules|\.test\.js$/,
options: { esModules: true },
enforce: 'post',
loader: require.resolve('istanbul-instrumenter-loader')
},
{
test: /\.(png|jpg|gif|mp4|ogg|svg|woff|woff2|eot|ttf)$/,
use: [{
loader: 'null-loader',
options: {
name: '[name].[ext]',
useRelativePath: false
}
}]
},
{
test: /\.(sass|scss)$/,
use: [
{
loader: 'null-loader',
options: {
sourceMap: true
}
}
]
}
]
},
plugins: [
new ExtraWatchWebpackPlugin({
dirs: ['./Resources/Private/JavaScript', `${basePackagePathAbsolute()}/Resources/Private/JavaScript`]
})
]
});
}