Skip to content

Commit 442071a

Browse files
committed
Webpack production mode, socket.io and TWEEN.js importing es6
1 parent 4923a31 commit 442071a

File tree

10 files changed

+255
-102
lines changed

10 files changed

+255
-102
lines changed

coffee/client/js/index.coffee

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ import {Entities} from './Entities.js'
1414
import {PlayerInInventory} from './PlayerInInventory.js'
1515
import {BlockBreak} from './BlockBreak.js'
1616
import {BlockPlace} from './BlockPlace.js'
17+
import io from 'socket.io-client'
18+
import TWEEN from "@tweenjs/tween.js"
19+
1720

1821
class Game
1922
constructor:(options)->
Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
buildPath="#{__dirname}/public"
33

44
module.exports=(env)->
5-
mode: if (env and env.prod) then 'production' else 'development'
5+
mode: "development"
66
entry: './js/index.js'
77
output:
88
path: buildPath
@@ -12,12 +12,7 @@ module.exports=(env)->
1212
maxAssetSize: 1.5e6
1313
stats:
1414
modules: false
15-
devtool: 'cheap-source-map'
16-
devServer:
17-
contentBase: buildPath
18-
inline: true
19-
host: "0.0.0.0"
20-
stats: "minimal"
15+
devtool: 'source-map'
2116
module:
2217
rules: [
2318
{

coffee/client/webpack.prod.coffee

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
buildPath="#{__dirname}/public"
3+
4+
module.exports=(env)->
5+
mode: "production"
6+
entry: './js/index.js'
7+
output:
8+
path: buildPath
9+
filename: 'bundle.js'
10+
performance:
11+
maxEntrypointSize: 1.5e6
12+
maxAssetSize: 1.5e6
13+
stats:
14+
modules: false
15+
module:
16+
rules: [
17+
{
18+
loader: "worker-loader"
19+
test: /\.worker\.js$/
20+
options:
21+
filename: "[contenthash].js"
22+
}
23+
]

docs/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ npm i
1919
#Coffeescript transpilation
2020
npm run coffee
2121

22-
#Websocket server (on port 8081)
22+
#Websocket server and development server
2323
npm start
24-
25-
#Development server (on port 8080)
2624
npm run dev
2725

26+
#Production build
27+
npm run build
28+
29+
2830
```
2931
<br>
3032
<h4>Screenshots:</h4>

package-lock.json

Lines changed: 176 additions & 78 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)