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
I've recently updated a project of mine to use the latest dev-server packages, those that include the commonjs and rollup3 fixes.
While doing so, I noticed an issue with commonjs-modules appearing as their absolute file-system paths in the browsers network tab. Upon investigation, I realized that this is somehow related to setting the rootDir option. Removing this options from the config fixes the import.
The broken imports appear to resolve "too far up" in the file system, walking outside of the projects folder, strangely the working non-commonjs imports also seem to resolve "too far up" , but end up working fine.
I have this issue too. Standard imports work, but as soon as I added plugin-commonjs, require() broke with invalid absolute paths.
I tracked it down to some faulty logic in the rollup adapter that's handling the null-byte paths and resolving the paths to be absolute - that logic isn't taking into account the rootDir at all. While I don't think they need to be turned into absolute paths, the fix to them is simple:
I've recently updated a project of mine to use the latest dev-server packages, those that include the commonjs and rollup3 fixes.
While doing so, I noticed an issue with commonjs-modules appearing as their absolute file-system paths in the browsers network tab. Upon investigation, I realized that this is somehow related to setting the
rootDir
option. Removing this options from the config fixes the import.The broken imports appear to resolve "too far up" in the file system, walking outside of the projects folder, strangely the working non-commonjs imports also seem to resolve "too far up" , but end up working fine.
I've managed to reproduce the issue in this branch:
https://github.com/lucaelin/rollup-commonjs-bug/tree/rootDir-commonjs
The text was updated successfully, but these errors were encountered: