-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
56 lines (50 loc) · 1.37 KB
/
webpack.config.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
const path = require('path');
const {
getWebpackDevServerConfig,
getWebpackBundleConfig,
} = require('codemirror-blocks/lib/toolkit/webpack');
const devServerConfig = getWebpackDevServerConfig({
context: path.resolve(__dirname, 'dev-server'),
entry: './index.js',
});
const bundleConfig = getWebpackBundleConfig({
entry: {
CodeMirrorBlocks: path.resolve(__dirname, 'src', 'languages', 'wescheme', 'index'),
},
});
const alias = {
jsnums: 'wescheme-js/src/runtime/js-numbers',
lex: 'wescheme-js/src/lex',
types: 'wescheme-js/src/runtime/types',
structs: 'wescheme-js/src/structures',
};
devServerConfig.module.rules.push({
test: /\.rkt$/,
use: [{ loader: 'raw-loader' }],
});
// Add aliases needed by WeschemeParser.js
// TODO(pcardune): stop using aliases and just import
// directly from the right place...?
devServerConfig.resolve.alias = alias;
bundleConfig.resolve.alias = alias;
bundleConfig.externals = {
'codemirror': 'codemirror',
'codemirror/addon/search/search' : 'codemirror',
'codemirror/addon/search/searchcursor' : 'codemirror',
'jsnums': 'jsnums',
'lex': {
commonjs: 'plt.compiler',
commonjs2: 'plt.compiler',
root: ['plt','compiler'],
},
'types': 'types',
'structs': {
commonjs: 'plt.compiler',
commonjs2: 'plt.compiler',
root: ['plt','compiler'],
},
};
module.exports = [
devServerConfig,
bundleConfig,
];