-
Notifications
You must be signed in to change notification settings - Fork 30
/
webpack.config.skulpt.js
57 lines (55 loc) · 1.78 KB
/
webpack.config.skulpt.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
const path = require('path');
const MergeIntoSingleFilePlugin = require('webpack-merge-and-include-globally');
const Uglify = require("uglify-js");
const babel = require("@babel/core");
// Skulpt
const JS_SKULPT_FILES = [
path.resolve(__dirname, 'src/skulpt/skulpt_shim.js'),
path.resolve(__dirname, 'src/skulpt/astnodes.js'),
/*path.resolve(__dirname, 'src/skulpt/skulpt_shim.js'),
path.resolve(__dirname, 'src/skulpt/skulpt_shim.js'),
path.resolve(__dirname, 'src/skulpt/skulpt_shim.js'),
path.resolve(__dirname, 'src/skulpt/skulpt_shim.js'),*/
];
const config = {
entry: [
path.resolve(__dirname, 'src/skulpt/skulpt_shim.js'),
],
output: {
path: __dirname + '/dist',
filename: 'skulpt_parser.js',
library: 'Skulpt'
},
module: {
rules: [
{
test: /(\.jsx|\.js)$/,
loader: "babel-loader",
exclude: /(node_modules|bower_components)/
},
]
},
resolve: {
extensions: ['.js']
},
plugins: [
new MergeIntoSingleFilePlugin({
files: {
"block_mirror.js": JS_SKULPT_FILES,
"block_mirror.css": [
/*path.resolve(__dirname, 'lib/codemirror/codemirror.css'),
path.resolve(__dirname, 'lib/codemirror/fullscreen.css'),
path.resolve(__dirname, 'lib/codemirror/show-hint.css'),*/
path.resolve(__dirname, 'src/block_mirror.css'),
]
},
transform: {
"block_mirror.js": code =>
babel.transform(code, {
presets: ["@babel/preset-env"]
}).code
}
})
]
};
module.exports = config;