Can build v4.2, but not v5.0...why not?

When I follow the detailed setup instruction here (with this fix), I get a working scene. But when I specify 5.0.0-alpha.14 instead of ^4.2.0 in package.json, then npm i, and then rerun everything my terminal blows up with errors, things like below. Are there special config settings for v5.0.0, or any updated setup instructions?

**ERROR** in **./node_modules/@babylonjs/core/Debug/debugLayer.js** **2:0-38**
**Module** **not found** **:** **Error** **: Can't resolve '../Misc/tools' in '/Users/jon/Desktop/BJS ES6/node_modules/@babylonjs/core/Debug'**
**Did you mean 'tools.js'?**
**BREAKING CHANGE** **: The request '../Misc/tools'** **failed** **to resolve only because it was resolved as fully specified**
**(probably because the origin is a '*.mjs' file or a '*.js' file where the package.json contains '"type": "module"').**
**The extension in the request is mandatory for it to be fully specified.**
**Add the extension to the request.**
@ ./src/app.ts 3:0-43

I dont think v5 is availble on npm.

It is, and it installs no problem: babylonjs - npm
I just can’t get it to build even though the exact same setup builds as 4.2.

Feels like some form of a configuration key is a bit off (or doesn’t support something we are doing :-)). Any chance of sharing the project you are trying to build? We constantly learn from each and every project we examine.

Thanks for the response @RaananW . The project is just the setup step from the Build a Game tutorial in the docs, which works as v4.2 but not as v5.0. I’d love to understand what I’m not doing correctly. Here is a repo if that helps: GitHub - jonarnold/bjs-latest

Thanks in advance!

Hi,

This seems to be a compatibility issue with webpack. You will need to add the following rule to webpack’s configuration:

            {
                test: /\.m?js/,
                resolve: {
                    fullySpecified: false,
                },
            },

@PirateJC - can you check where it can be added in the docs?

1 Like

Yeah @RaananW that totally fixed it, thank you. (Oh how I wish I actually understood webpack…)

I don’t think the people developing webpack really know webpack :wink:

If you are interesting in understanding what the issue is - Module | webpack

It is a combination of webpack’s new default behavior and the way we are packing the framework

2 Likes