Skip to content

Commit b23e7bf

Browse files
committed
get webpack working
1 parent 5a64345 commit b23e7bf

File tree

9 files changed

+94
-7
lines changed

9 files changed

+94
-7
lines changed

package-lock.json

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

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
"css-loader": "^6.7.1",
2020
"eslint": "^8.27.0",
2121
"eslint-webpack-plugin": "^3.2.0",
22+
"exports-loader": "^4.0.0",
2223
"html-webpack-plugin": "^5.5.0",
24+
"imports-loader": "^4.0.1",
2325
"mini-css-extract-plugin": "^2.6.1",
2426
"source-map-loader": "^1.0.0",
2527
"springroll": "^2.4.4",

src/cache.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import createjs from 'createjs';
2+
13
class Cache
24
{
35
constructor()

src/game.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { TitleScene } from './scenes/title';
22
import { Property, SafeScaleManager, Application } from 'springroll';
33
import { GAMEPLAY } from './constants';
4+
import createjs from 'createjs';
45

56
export class Game
67
{

src/gameobjects/ball.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { GAMEPLAY } from './../constants';
22
import { GameCache } from '../cache';
3+
import createjs from 'createjs';
34

45
export class Ball extends createjs.Bitmap
56
{

src/scenes/gameScene.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Scene } from "./scene";
22
import { Ball } from "../gameobjects/ball";
33
import { GameCache } from "../cache";
4+
import createjs from 'createjs';
45

56
export class GameScene extends Scene
67
{
@@ -20,7 +21,7 @@ export class GameScene extends Scene
2021

2122
queue.on('fileload', (event) => GameCache.onLoad(event));
2223

23-
const loadComplete = new Promise((resolve, reject) =>
24+
const loadComplete = new Promise((resolve) =>
2425
{
2526
queue.on("complete", resolve);
2627
});

src/scenes/scene.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class Scene extends createjs.Container
1818
{
1919
}
2020

21-
update(deltaTime)
21+
update()
2222
{
2323
}
2424

src/scenes/title.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { GameScene } from './gameScene';
22
import { Scene } from './scene';
33
import { Anchor } from 'springroll';
4+
import createjs from 'createjs';
45

56
export class TitleScene extends Scene
67
{

webpack.config.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,23 @@ module.exports = (env) => {
5454
rules: [
5555
{
5656
test: /node_modules[/\\]createjs/,
57-
loaders: [
58-
'imports-loader?this=>window',
59-
'exports-loader?window.createjs'
60-
]
61-
},
57+
use: [{
58+
loader: 'exports-loader',
59+
options: {
60+
type: 'commonjs',
61+
exports: 'single window.createjs',
62+
},
63+
}],
64+
},
65+
{
66+
test: /node_modules[/\\]createjs/,
67+
use: [{
68+
loader: 'imports-loader',
69+
options: {
70+
wrapper: 'window',
71+
},
72+
}],
73+
},
6274
{
6375
test: /\.css$/,
6476
use: [MiniCssExtractPlugin.loader, 'css-loader']

0 commit comments

Comments
 (0)