This repository was archived by the owner on Nov 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.test.js
More file actions
100 lines (98 loc) · 2.91 KB
/
Copy pathwebpack.config.test.js
File metadata and controls
100 lines (98 loc) · 2.91 KB
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
90
91
92
93
94
95
96
97
98
99
100
/* global __dirname */
// see http://stackoverflow.com/questions/32385219/mocha-tests-dont-run-with-webpack-and-mocha-loader
const webpack = require('webpack');
const path = require('path');
module.exports = {
entry: './test-client/all.js',
output: {
filename: 'test.build.js',
path: path.join(__dirname, 'test-client/'),
},
externals: {
'highlight.js': 'hljs',
'markdown-it': 'markdownit',
'katex': 'katex',
},
module: {
rules: [
{
test: /\.js$/,
include: [
// We explicitly include all directory, otherwise, this will break
// as 'exclude' has a higher priority than include
path.join(__dirname, 'common'),
path.join(__dirname, 'client'),
path.join(__dirname, 'test-client'),
// Add all npm modules that need to be transpiled!
// Include xterm module
/\bxterm\b/,
],
loader: 'babel-loader',
query: {
presets: [['@babel/preset-env', { modules: false }], '@babel/preset-react'],
plugins: [
'emotion',
'@babel/plugin-transform-runtime',
'@babel/plugin-proposal-object-rest-spread',
// Stage 2
['@babel/plugin-proposal-decorators', { 'legacy': true }],
'@babel/plugin-proposal-export-namespace-from',
'@babel/plugin-proposal-throw-expressions',
// Stage 3
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-syntax-import-meta',
['@babel/plugin-proposal-class-properties', { 'loose': false }],
'@babel/plugin-proposal-json-strings'
]
}
},
{
test: /\.scss$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: { importLoaders: 1 }
},
{
loader: 'postcss-loader',
options: {
config: {
path: path.resolve(__dirname, 'postcss.config.js'),
},
}
},
'sass-loader'
]
},
{
// Do not transform vendor's CSS with CSS-modules
// The point is that they remain in global scope.
// Since we require these CSS files in our JS or CSS files,
// they will be a part of our compilation either way.
// So, no need for ExtractTextPlugin here.
test: /\.css$/,
include: /node_modules/,
use: ['style-loader', 'css-loader'],
},
{
test: /\.json$/,
loader: 'json-loader'
}
],
noParse: [/acorn\/dist\/acorn\.js$/, /xterm\/lib\/.*$/]
},
plugins: [
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('development')
}
})
],
node: {
Buffer: true,
fs: 'empty' // needed for term.js
},
devtool: 'inline-source-map'
};