How to fix module is not defined error (Babylon.js Editor 3.2.0)

Hi, I tried a WebXR contents on Babylon.js Editor 3.2. The editor is very useful and “Export Project template” worked fine.

Building the project also worked well (npm install, npm run build, npm run webserver. => http://localhost:1338).

When I uploaded the project files on my a Github repository. Github noticed me a security vulnerability.

Known moderate severity security vulnerability detected in ecstatic <= 4.1.2 defined in package-lock.json .

Therefore, I fixed the security error by using ncu command.

$ npm install -g npm-check-updates
$ ncu 
$ ncu -u
[====================] 22/22 100%

 systemjs-plugin-css                  ~0.1.35  →  ~0.1.37 
 systemjs                            ~0.20.19  →   ~6.3.1 
 rimraf                                ~2.6.2  →   ~3.0.2 
 es6-promise                           ~4.1.0  →   ~4.2.8 
 litegraph.js                           0.7.0  →    0.7.5 
 @babylonjs/core                 4.1.0-beta.3  →    4.1.0 
 @babylonjs/loaders              4.1.0-beta.3  →    4.1.0 
 @babylonjs/materials            4.1.0-beta.3  →    4.1.0 
 @babylonjs/post-processes       4.1.0-beta.3  →    4.1.0 
 @babylonjs/procedural-textures  4.1.0-beta.3  →    4.1.0 
 @babylonjs/gui                  4.1.0-beta.3  →    4.1.0 
 earcut                                ~2.1.3  →   ~2.2.2 
 @types/systemjs                       0.20.6  →    6.1.0 
 typescript                             3.5.1  →    3.8.3 
 http-server                          ^0.11.1  →  ^0.12.1 
 webpack                               4.41.2  →   4.42.1 
 webpack-cli                           3.3.10  →   3.3.11 
 ts-loader                              4.4.2  →    7.0.0 
 babel-loader                           8.0.4  →    8.1.0 
$ npm install

After the fix, npm run build and run webserver command workes. But I could not access the http://localhost:1338 because of the following error.

Uncaught ReferenceError: module is not defined
    at bundle.js:2
Uncaught (in promise) ReferenceError: module is not defined
    at bundle.js:2

I think the “module” is related with src/game.ts or tsconfig.json. But it is difficult for my poor typescript to find the cause.

Any comment will be helpful for me. Great thanks in advance.

Pinging @julien-moreau

1 Like

Hi @Limes2018!

Happy to help, you can access localhost:1338 and the error happens in chrome yes ?

Can you send me the template as zip so I can have a look ? Would be really helpful for me

Great appreciate your help!

Please download the files. It works because no ncu command executed.

Saved BJS editor files.
https://drive.google.com/open?id=1U1cK4P3yIP53KyDxj8zgAeLVay8leaV-

Ref:
The p

The issue happens on the commit id of repository
add nojekyll options