proyecto26 / ion-phaser

A web component to use Phaser Framework with Angular, React, Vue, etc 🎮
https://market.ionicframework.com/plugins/ionphaser
MIT License
251 stars 39 forks source link

Failed to parse source map warnings - @ion-phaser/react #44

Open gfdb opened 2 years ago

gfdb commented 2 years ago

After running npm install @ion-phaser/core and npm install @ion-phaser/react. I am successfully able to install both packages. After running my code, which is the following:

import React, { useRef, useState } from 'react'
import Phaser from 'phaser'
import GameScene from './game_scene';
import { IonPhaser } from '@ion-phaser/react'

function Engine() {

    const game = {
        type: Phaser.AUTO,
        width: 800,
        height: 60,
        physics: {
            default: 'arcade',
            arcade: {
                gravity: { y: 200 }
            }
        },
        scene: [GameScene]

    }

    const gameRef = useRef(null)

    const [initialize] = useState(true)

    // const destroy = () => {
    //     if (gameRef.current) {
    //         gameRef.current.destroy()
    //     }
    //     setInitialize(false)
    // }
    return(
        <>
            <IonPhaser ref = {gameRef} game = {game} initialize={initialize}/>
        </>

    )
}

export default Engine;

I get the following warnings/errors:

WARNING in ./node_modules/@ion-phaser/react/dist/components.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'C:\Users\gianf\Documents\studio-code\javascript\gfdb-site\gfdb-frontend\node_modules\@ion-phaser\react\src\components.ts' file: Error: ENOENT: no such file or directory, open 'C:\Users\gianf\Documents\studio-code\javascript\gfdb-site\gfdb-frontend\node_modules\@ion-phaser\react\src\components.ts'
 @ ./node_modules/@ion-phaser/react/dist/index.js 1:0-29 1:0-29
 @ ./src/components/engine/index.js 9:0-46 39:35-44
 @ ./src/components/home/index.js 5:0-31 9:30-36
 @ ./src/App.js 5:0-38 13:37-41
 @ ./src/index.js 7:0-24 11:33-36

WARNING in ./node_modules/@ion-phaser/react/dist/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'C:\Users\gianf\Documents\studio-code\javascript\gfdb-site\gfdb-frontend\node_modules\@ion-phaser\react\src\index.ts' file: Error: ENOENT: no such file or directory, open 'C:\Users\gianf\Documents\studio-code\javascript\gfdb-site\gfdb-frontend\node_modules\@ion-phaser\react\src\index.ts'
 @ ./src/components/engine/index.js 9:0-46 39:35-44
 @ ./src/components/home/index.js 5:0-31 9:30-36
 @ ./src/App.js 5:0-38 13:37-41
 @ ./src/index.js 7:0-24 11:33-36

WARNING in ./node_modules/@ion-phaser/react/dist/react-component-lib/createComponent.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'C:\Users\gianf\Documents\studio-code\javascript\gfdb-site\gfdb-frontend\node_modules\@ion-phaser\react\src\react-component-lib\createComponent.tsx' file: Error: ENOENT: no such file or directory, open 'C:\Users\gianf\Documents\studio-code\javascript\gfdb-site\gfdb-frontend\node_modules\@ion-phaser\react\src\react-component-lib\createComponent.tsx'
 @ ./node_modules/@ion-phaser/react/dist/react-component-lib/index.js 1:0-57 1:0-57
 @ ./node_modules/@ion-phaser/react/dist/components.js 6:0-61 9:38-58
 @ ./node_modules/@ion-phaser/react/dist/index.js 1:0-29 1:0-29
 @ ./src/components/engine/index.js 9:0-46 39:35-44
 @ ./src/components/home/index.js 5:0-31 9:30-36
 @ ./src/App.js 5:0-38 13:37-41
 @ ./src/index.js 7:0-24 11:33-36

WARNING in ./node_modules/@ion-phaser/react/dist/react-component-lib/createOverlayComponent.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'C:\Users\gianf\Documents\studio-code\javascript\gfdb-site\gfdb-frontend\node_modules\@ion-phaser\react\src\react-component-lib\createOverlayComponent.tsx' file: Error: ENOENT: no such file or 
directory, open 'C:\Users\gianf\Documents\studio-code\javascript\gfdb-site\gfdb-frontend\node_modules\@ion-phaser\react\src\react-component-lib\createOverlayComponent.tsx'
 @ ./node_modules/@ion-phaser/react/dist/react-component-lib/index.js 2:0-66 2:0-66
 @ ./node_modules/@ion-phaser/react/dist/components.js 6:0-61 9:38-58
 @ ./node_modules/@ion-phaser/react/dist/index.js 1:0-29 1:0-29
 @ ./src/components/engine/index.js 9:0-46 39:35-44
 @ ./src/components/home/index.js 5:0-31 9:30-36
 @ ./src/App.js 5:0-38 13:37-41
 @ ./src/index.js 7:0-24 11:33-36

WARNING in ./node_modules/@ion-phaser/react/dist/react-component-lib/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'C:\Users\gianf\Documents\studio-code\javascript\gfdb-site\gfdb-frontend\node_modules\@ion-phaser\react\src\react-component-lib\index.ts' file: Error: ENOENT: no such file or directory, open 'C:\Users\gianf\Documents\studio-code\javascript\gfdb-site\gfdb-frontend\node_modules\@ion-phaser\react\src\react-component-lib\index.ts'
 @ ./node_modules/@ion-phaser/react/dist/components.js 6:0-61 9:38-58
 @ ./node_modules/@ion-phaser/react/dist/index.js 1:0-29 1:0-29
 @ ./src/components/engine/index.js 9:0-46 39:35-44
 @ ./src/components/home/index.js 5:0-31 9:30-36
 @ ./src/App.js 5:0-38 13:37-41
 @ ./src/index.js 7:0-24 11:33-36

WARNING in ./node_modules/@ion-phaser/react/dist/react-component-lib/utils/attachProps.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'C:\Users\gianf\Documents\studio-code\javascript\gfdb-site\gfdb-frontend\node_modules\@ion-phaser\react\src\react-component-lib\utils\attachProps.ts' file: Error: ENOENT: no such file or directory, open 'C:\Users\gianf\Documents\studio-code\javascript\gfdb-site\gfdb-frontend\node_modules\@ion-phaser\react\src\react-component-lib\utils\attachProps.ts'
 @ ./node_modules/@ion-phaser/react/dist/react-component-lib/utils/index.js 27:0-30 27:0-30
 @ ./node_modules/@ion-phaser/react/dist/react-component-lib/createOverlayComponent.js 46:0-38 89:10-21 131:8-19
 @ ./node_modules/@ion-phaser/react/dist/react-component-lib/index.js 2:0-66 2:0-66
 @ ./node_modules/@ion-phaser/react/dist/components.js 6:0-61 9:38-58
 @ ./node_modules/@ion-phaser/react/dist/index.js 1:0-29 1:0-29
 @ ./src/components/engine/index.js 9:0-46 39:35-44
 @ ./src/components/home/index.js 5:0-31 9:30-36
 @ ./src/App.js 5:0-38 13:37-41
 @ ./src/index.js 7:0-24 11:33-36

WARNING in ./node_modules/@ion-phaser/react/dist/react-component-lib/utils/case.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'C:\Users\gianf\Documents\studio-code\javascript\gfdb-site\gfdb-frontend\node_modules\@ion-phaser\react\src\react-component-lib\utils\case.ts' file: Error: ENOENT: no such file or directory, open 'C:\Users\gianf\Documents\studio-code\javascript\gfdb-site\gfdb-frontend\node_modules\@ion-phaser\react\src\react-component-lib\utils\case.ts'
 @ ./node_modules/@ion-phaser/react/dist/react-component-lib/utils/index.js 28:0-23 28:0-23
 @ ./node_modules/@ion-phaser/react/dist/react-component-lib/createOverlayComponent.js 46:0-38 89:10-21 131:8-19
 @ ./node_modules/@ion-phaser/react/dist/react-component-lib/index.js 2:0-66 2:0-66
 @ ./node_modules/@ion-phaser/react/dist/components.js 6:0-61 9:38-58
 @ ./node_modules/@ion-phaser/react/dist/index.js 1:0-29 1:0-29
 @ ./src/components/engine/index.js 9:0-46 39:35-44
 @ ./src/components/home/index.js 5:0-31 9:30-36
 @ ./src/App.js 5:0-38 13:37-41
 @ ./src/index.js 7:0-24 11:33-36

WARNING in ./node_modules/@ion-phaser/react/dist/react-component-lib/utils/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'C:\Users\gianf\Documents\studio-code\javascript\gfdb-site\gfdb-frontend\node_modules\@ion-phaser\react\src\react-component-lib\utils\index.tsx' file: Error: ENOENT: no such file or directory, 
open 'C:\Users\gianf\Documents\studio-code\javascript\gfdb-site\gfdb-frontend\node_modules\@ion-phaser\react\src\react-component-lib\utils\index.tsx'
 @ ./node_modules/@ion-phaser/react/dist/react-component-lib/createOverlayComponent.js 46:0-38 89:10-21 131:8-19
 @ ./node_modules/@ion-phaser/react/dist/react-component-lib/index.js 2:0-66 2:0-66
 @ ./node_modules/@ion-phaser/react/dist/components.js 6:0-61 9:38-58
 @ ./node_modules/@ion-phaser/react/dist/index.js 1:0-29 1:0-29
 @ ./src/components/engine/index.js 9:0-46 39:35-44
 @ ./src/components/home/index.js 5:0-31 9:30-36
 @ ./src/App.js 5:0-38 13:37-41
 @ ./src/index.js 7:0-24 11:33-36

8 warnings have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

webpack 5.69.1 compiled with 8 warnings in 18791 ms

React version: ^16.7.0 React-dom: ^16.7.0 How can I fix this?

jdnichollsc commented 2 years ago

Hello mate, thanks for reporting this issue!

Very odd, let me check! in the meantime, you can try using a hook approach instead: https://stackblitz.com/edit/react-phaser

Best Regards, Juan