Follow-up of #2256, this PR drops the CJS (CommonJS modules) distribution is favor of a standard ESM (ECMAScript) distribution.
Fixes #2256
Motivation and Context
2252 bumped the web browser requirements. This guarantees that we now only support ESM-compatible browsers. Moreover, three.js is currently migrating to a pure ESM package.
TODOs
[x] add the type: module field to the package.json
[x] webpack config file.
[x] eslint config files (loaded with require(), shall be .cjs)
[x] unit tests.
[x] functional tests (CJS to ESM syntax).
[x] coverage tests (incompatibility with nyc, change to c8). #2299
[x] transpilation with babel.
[x] documentation scripts (JSDoc publish.js is loaded with require() and shall be commonJS).
[x] prepare script (already .mjs)
[x] replace script (already .mjs)
[x] changelog script (loaded with require(), shall be .cjs)
[x] bump script (loaded with require(), shall be .cjs)
Description
Follow-up of #2256, this PR drops the
CJS
(CommonJS modules) distribution is favor of a standardESM
(ECMAScript) distribution.Fixes #2256
Motivation and Context
2252 bumped the web browser requirements. This guarantees that we now only support ESM-compatible browsers. Moreover,
three.js
is currently migrating to a pureESM
package.TODOs
type: module
field to thepackage.json
webpack
config file.eslint
config files (loaded withrequire()
, shall be .cjs)nyc
, change toc8)
. #2299babel
.publish.js
is loaded withrequire()
and shall be commonJS).prepare
script (already.mjs
)replace
script (already.mjs
)changelog
script (loaded withrequire()
, shall be.cjs
)bump
script (loaded withrequire()
, shall be.cjs
)