pmndrs / postprocessing

A post processing library for three.js.
zlib License
2.37k stars 213 forks source link

Regression: Incorrect import `/node_modules/three/addons/misc/Timer.js` #611

Closed hybridherbst closed 8 months ago

hybridherbst commented 8 months ago

Description of the bug

I think this is a regression introduced by https://github.com/pmndrs/postprocessing/commit/2aab3111cd56627b17d86f1869eac37ca66321e0. The timer import incorrectly uses "addons" which requires import maps support or correct package.json exports parsing (not available for every tool/bundler/combination, see https://github.com/mrdoob/three.js/pull/27381)

Example when using Vite 4.x: image

I think it should use three/examples/jsm instead of three/addons.

vanruesc commented 8 months ago

Thanks for the report! That's a bummer. I'll prepare a fix in a bit.

vanruesc commented 8 months ago

Should be fixed in postprocessing@6.35.1.

sommerper commented 8 months ago

I installed via npm and it seems to still be in there: image

And when building my app I get:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/xyz/nodeprojects/xyz.com/build/node_modules/three/examples/jsm/misc/Timer.js' imported from /home/xyz/nodeprojects/xyz.com/build/node_modules/postprocessing/build/index.js
    at finalizeResolution (node:internal/modules/esm/resolve:263:11)
    at moduleResolve (node:internal/modules/esm/resolve:908:10)
    at defaultResolve (node:internal/modules/esm/resolve:1131:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:390:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:359:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:234:38)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:85:39)
    at link (node:internal/modules/esm/module_job:84:36) {
  code: 'ERR_MODULE_NOT_FOUND',
  url: 'file:///home/xyz/nodeprojects/xyz.com/build/node_modules/three/examples/jsm/misc/Timer.js'
vanruesc commented 8 months ago

@sommerper Uh oh, that's another regression. Timer was added in three r160 which means that using older versions of three results in an error. I'll push a fix tomorrow.

vanruesc commented 8 months ago

@sommerper Should be fixed in postprocessing@6.35.2.