Skip to content

Commit d434219

Browse files
committed
started adding webpack config to v5 "unity"
1 parent d23938b commit d434219

4 files changed

Lines changed: 72 additions & 2 deletions

File tree

‎v3/visualize.html‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@
8484

8585
<!-- insert google-analytics.txt contents here -->
8686

87-
</script>
88-
8987
</head>
9088

9189
<body>

‎v5-unity/README.txt‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
Online Python Tutor v5 "unity" -- the goal for this version is to
3+
significantly clean up, modernize, and modularize the OPT codebase to
4+
ease future development.
5+
6+
I started porting v3/ over to v5-unity/ on 2016-06-12 since the headache
7+
of manually maintaining so many JS/CSS files and intricate dependencies
8+
was starting to get out of hand ... i've waited for years to port to a
9+
more sustainable and modern development setup ...
10+
11+
12+
Requires these global installations:
13+
- Node.js / npm
14+
- webpack: http://webpack.github.io/ and webpack-dev-server
15+
npm install webpack -g
16+
npm install webpack-dev-server -g
17+
18+
If you run:
19+
webpack-dev-server --progress --colors
20+
21+
then your code will automatically recompile and be refreshed here:
22+
http://localhost:8080/webpack-dev-server/
23+

‎v5-unity/package.json‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "v5-unity",
3+
"version": "1.0.0",
4+
"description": "OPT v5",
5+
"main": "bundle.js",
6+
"repository": "https://github.com/pgbovine/OnlinePythonTutor",
7+
"license": "BSD-3-Clause",
8+
9+
"scripts": {
10+
"start": "webpack-dev-server --hot --inline",
11+
"webpack": "webpack --progress --colors --watch"
12+
},
13+
14+
"dependencies" : {
15+
"css-loader" : "",
16+
"style-loader" : "",
17+
"file-loader" : ""
18+
}
19+
}

‎v5-unity/webpack.config.js‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
module.exports = {
2+
entry: "./js/opt-frontend.js",
3+
4+
// some included libraries reference 'jquery', so point to it:
5+
resolve : {
6+
alias: {
7+
"jquery": __dirname + "/js/jquery-1.8.2.min.js",
8+
"$": __dirname + "/js/jquery-1.8.2.min.js",
9+
"$.bbq": __dirname + "/js/jquery.ba-bbq.min.js",
10+
}
11+
},
12+
13+
output: {
14+
path: __dirname + "/webpack-output/",
15+
// TODO: use 'bundle.[hash].js' for fingerprint hashing
16+
// to create unique filenames for releases:
17+
// https://webpack.github.io/docs/long-term-caching.html
18+
filename: "bundle.js",
19+
sourceMapFilename: "[file].map",
20+
},
21+
22+
module: {
23+
loaders: [
24+
{ test: /\.css$/, loader: "style!css" },
25+
{ test: /\.(png|jpg)$/, loader: 'file-loader' }
26+
]
27+
},
28+
29+
devtool: 'source-map', // VERY important to have source maps for debugging
30+
};

0 commit comments

Comments
 (0)