You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
xhr-sync-worker.js in jsdom should be correctly included in dynamicRequireTargets as configured.
Expected output
Hello jsdom [object Window]!
Actual Behavior
Executing the output script fails with this error
Error: Cannot find module './xhr-sync-worker.js'
Require stack:
- /home/projects/rollup-repro-lhjkysjm/server/dist/main.js
at _0x4a2c83 (https://rollupreprolhjkysjm-orah.w-corp-staticblitz.com/blitz.495c5120.js:40:21530)
at internal/modules/cjs/loader/Module._resolveFilename (node:internal/modules/cjs/loader:144:12334)
at resolve (node:internal/modules/helpers:163:2873)
at requireXMLHttpRequestImpl (/home/projects/rollup-repro-lhjkysjm/server/dist/main.js:197494:51)
at requireXMLHttpRequest/< (/home/projects/rollup-repro-lhjkysjm/server/dist/main.js:199147:16)
at requireXMLHttpRequest (/home/projects/rollup-repro-lhjkysjm/server/dist/main.js:199148:4)
at requireInterfaces (/home/projects/rollup-repro-lhjkysjm/server/dist/main.js:208335:20)
at requireWindow (/home/projects/rollup-repro-lhjkysjm/server/dist/main.js:209876:32)
at requireApi (/home/projects/rollup-repro-lhjkysjm/server/dist/main.js:210999:27)
at requireMain (/home/projects/rollup-repro-lhjkysjm/server/dist/main.js:211328:20)
at _0x339e27 (https://rollupreprolhjkysjm-orah.w-corp-staticblitz.com/blitz.495c5120.js:40:811403)
at internal/modules/cjs/loader/Module.prototype._compile (node:internal/modules/cjs/loader:144:14246)
at internal/modules/cjs/loader/Module."] (node:internal/modules/cjs/loader:144:14855)
at internal/modules/cjs/loader/Module.prototype.load (node:internal/modules/cjs/loader:144:12820)
at internal/modules/cjs/loader/Module._load (node:internal/modules/cjs/loader:144:10273)
at executeUserEntryPoint (node:internal/modules/run_main:165:1641)
at internal/main/run_main_module (node:internal/main/run_main_module:138:398)
at _0x5dd822 (https://rollupreprolhjkysjm-orah.w-corp-staticblitz.com/blitz.495c5120.js:40:1444999)
at executeBootstrapper (https://rollupreprolhjkysjm-orah.w-corp-staticblitz.com/blitz.495c5120.js:40:908549)
at startExecution (https://rollupreprolhjkysjm-orah.w-corp-staticblitz.com/blitz.495c5120.js:40:1476481)
at run (https://rollupreprolhjkysjm-orah.w-corp-staticblitz.com/blitz.495c5120.js:40:1475098) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/home/projects/rollup-repro-lhjkysjm/server/dist/main.js' ]
}
Additional Information
After going through change log and a bit of console log debugging, I realized this is caused by recent dependency change from glob -> fdir in v28. The reproduction works as expected if commonjs plugin version is changed to v27.
While absolute paths are not working anymore, based on the way fdir works, I believe currently there is no way to configure dynamicRequireTargets to include a file outside cwd (in this case server directory).
A possible solution is to add a config option to pass a root dir to crawl() here. In my case, crawl('..') works.
Expected Behavior
Build
Run
xhr-sync-worker.js
in jsdom should be correctly included indynamicRequireTargets
as configured.Expected output
Actual Behavior
Executing the output script fails with this error
Additional Information
After going through change log and a bit of console log debugging, I realized this is caused by recent dependency change from glob -> fdir in v28. The reproduction works as expected if commonjs plugin version is changed to v27.
While absolute paths are not working anymore, based on the way fdir works, I believe currently there is no way to configure
dynamicRequireTargets
to include a file outside cwd (in this caseserver
directory).A possible solution is to add a config option to pass a root dir to
crawl()
here. In my case,crawl('..')
works.plugins/packages/commonjs/src/dynamic-modules.js
Line 49 in 0293e8f
The text was updated successfully, but these errors were encountered: