-
Notifications
You must be signed in to change notification settings - Fork 6
/
webpack.config.babel.test.js
46 lines (43 loc) · 1.33 KB
/
webpack.config.babel.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
const path = require('path')
const nodeExternals = require('webpack-node-externals')
require('regenerator-runtime/runtime')
const webpackTestConfig = {
mode: 'development',
target: 'node', // in order to ignore built-in modules like path, fs, etc.
externals: [nodeExternals()], // in order to ignore all modules in node_modules folder
resolve: {
extensions: ['.webpack-loader.js', '.web-loader.js', '.loader.js', '.js', '.jsx', '.ts', '.tsx'],
alias: {
i18n: path.resolve(__dirname, 'src/i18n/'),
client: path.resolve(__dirname, 'src/client/'),
meta: path.resolve(__dirname, 'src/meta/'),
server: path.resolve(__dirname, 'src/server/'),
test: path.resolve(__dirname, 'src/test/'),
utils: path.resolve(__dirname, 'src/utils/'),
},
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'babel-loader',
},
{
test: /\.(js|jsx)$/,
exclude: /(node_modules)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env', '@babel/react'],
plugins: ['@babel/plugin-proposal-object-rest-spread', '@babel/plugin-syntax-dynamic-import'],
},
},
},
{
test: /\.(less|css)$/,
loader: 'null-loader',
},
],
},
}
module.exports = webpackTestConfig