forked from hcientist/OnlinePythonTutor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
69 lines (62 loc) · 2.32 KB
/
webpack.config.js
File metadata and controls
69 lines (62 loc) · 2.32 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
var webpack = require('webpack');
var WebpackOnBuildPlugin = require('on-build-webpack');
var exec = require('child_process').exec;
module.exports = {
plugins: [
// http://stackoverflow.com/questions/29080148/expose-jquery-to-real-window-object-with-webpack
new webpack.ProvidePlugin({
// Automtically detect jQuery and $ as free var in modules
// and inject the jquery library
// This is required by many jquery plugins
jquery: "jquery",
jQuery: "jquery",
$: "jquery"
}),
// run a micro frontend regression test after every webpack build
// to sanity-check
new WebpackOnBuildPlugin(function(stats) {
console.log("\n");
exec("cd ../tests/frontend-regression-tests/ && make micro", (error, stdout, stderr) => {
console.log(stdout);
if (stderr) {
console.log(`Test stderr: ${stderr}`);
}
});
}),
],
// some included libraries reference 'jquery', so point to it:
resolve : {
alias: {
"jquery": __dirname + "/js/lib/jquery-3.0.0.min.js",
"$": __dirname + "/js/lib/jquery-3.0.0.min.js",
"$.bbq": __dirname + "/js/lib/jquery.ba-bbq.js",
}
},
entry: {
'visualize': "./js/visualize.ts",
'opt-live': "./js/opt-live.ts",
'iframe-embed': "./js/iframe-embed.ts",
'embedding-demo': "./js/embedding-demo.ts",
'index': "./js/index.ts",
'composingprograms': "./js/composingprograms.ts",
'csc108h': "./js/csc108h.ts",
},
output: {
path: __dirname + "/build/",
// TODO: use 'bundle.[hash].js' for fingerprint hashing
// to create unique filenames for releases:
// https://webpack.github.io/docs/long-term-caching.html
filename: "[name].bundle.js",
sourceMapFilename: "[file].map",
},
module: {
loaders: [
{ test: /\.css$/, loader: "style!css" }, // CSS
{ test: /\.(png|jpg)$/, loader: 'url-loader' }, // images
{ test: /\.ts$/, loader: 'ts-loader' } // TypeScript
]
},
//devtool: 'source-map', // source maps are very important to ease debugging
// nix this, and use the command-line option "--devtool sourcemap" to create
// source maps in a debugging build
};