adding the type key "module" on the root will make threejs ESM-only
See original GitHub issueDescribe the bug
Hello!
I was worried about this change of #23315 so I tested it and it validated my concern. By adding the type key on the root "type": "module"
it will make threejs ESM-only and break all non-ESM libraries.
It should only be used in directories/user projects using ESM features such as test/package.json for example.
Can we simply remove this line:
"type": "module",
or does the new paths ./ will break? @marcofugaro
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Add .cjs build output needed for commonjs environments by ...
According to the docs one more thing is needed, an esm module must provide a .cjs file for commonjs environment. Added a short...
Read more >Installation – three.js docs
Make sure to add { "type": "module" } to your package.json to enable ES6 modules in your node project.
Read more >Importing Three.js as Module - Medium
Type npm init and press enter several times to accept the defaults. Type dir and there will be a new file in the...
Read more >The Structure of a three.js App
We'll create this basic web page out of just two files: index.html, and styles/main.css. That's it. Open up the editor by pressing the...
Read more >Three.js Fundamentals
A Scene in three.js is the root of a form of scene graph. Anything you want three.js to draw needs to be added...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I would say we give @marcofugaro’s solution a try and see how it works.
Not true, my attempt was to make three.js work both in esm and commonjs environment, according to the docs, I just forgot to provide a file with the
.cjs
extension.Creating a new build output with the
.cjs
file fixes this.