I am following a course to create a TS/JS-based game through webpack and Phaser. My GameScene Code is
import { Map } from "../components/map";
import TilesGroup from "../components/tiles/tilesGroup";
import Player from "../components/player/player";
export default class MainScene extends Phaser.Scene{
player: Player
tileGroup: TilesGroup
cursors: Phaser.Input.Keyboard.CursorKeys
level: number
constructor(){
super({
key: "MainScene"
})
}
init(props: {level? : number}){
const {level = 0} = props
this.level= Map.calcCurrentLevel(level)
}
create(){
const map= new Map(this.level)
this.cameras.main.setBackgroundColor('#ade6ff')
this.cameras.main.fadeIn()
this.cameras.main.setBounds(map.size.x, map.size.y, map.size.width, map.size.height)
this.physics.world.setBounds(map.size.x, map.size.y, map.size.width, map.size.height)
this.input.addPointer(1)
this.cursors = this.input.keyboard.createCursorKeys()
this.tileGroup= new TilesGroup(this,map.info.filter((el: TilesConfig) => el.type==="tile"))
this.player= new Player(this,map.info.filter((el: TilesConfig) => el.type==="player")[0], map.size, this.level)
this.cameras.main.startFollow(this.player)
this.physics.add.collider (this.tileGroup, this.player)
}
update(time: number, delta: number): void{
this.player.update(this.cursors)
}
}
I get the following webpack error when i try to run the command npm run build:
[webpack-cli] Failed to load 'C:UsersvivekLearningdemoplatformer+gameplatformer gamewebpackwebpack.dev.js' config
[webpack-cli] Invalid options object. Copy Plugin has been initialized using an options object that does not match the API schema.
- options[0] has an unknown property 'to'. These properties are valid:
object { patterns, options? }
- options[1] has an unknown property 'to'. These properties are valid:
object { patterns, options? }
- options[2] has an unknown property 'to'. These properties are valid:
object { patterns, options? }
I was expecting the webpack to be ready and run my game through the command npm start