Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid build if chunkFileName has wrong path segment separator for OS #3993

Closed
jacksteamdev opened this issue Mar 12, 2021 · 1 comment
Closed

Comments

@jacksteamdev
Copy link
Contributor

jacksteamdev commented Mar 12, 2021

  • Rollup Version: ^2.41.2
  • Operating System (or Browser): Linux Mint 19.3 Cinnamon and Windows 10
  • Node Version (if applicable): v14.15.1
  • Link to reproduction (IMPORTANT, read below): https://repl.it/join/mumhzhkb-jacksteamdev

Expected Behavior

When the wrong path segment separator for the OS is used for output.chunkFileNames to put chunks in a subfolder, Rollup should error or generate a working bundle.

An alternative solution would be to change the docs to suggest using path.join('chunks','[name]-[hash].js'), instead of a forward slash.

Actual Behavior

Rollup outputs an invalid bundle if the POSIX separator is used on Windows. The chunks are not put into a folder, but rather the intended folder name is literally in the file name. The import paths have the intended structure, but those files do not exist.

I used an escaped backslash in the REPL to demonstrate the problem. The behavior is the same on Windows with a forward slash or on POSIX with a backslash.

This is a problem on shared boilerplates. Related issue: extend-chrome/js-react-boilerplate#2

@lukastaegert
Copy link
Member

Actually the intention was to always use forward slashes in the bundle object on all environments to have consistent bundle objects across environments. Until now I always assumed that fs.writeFile would work correctly on Windows (actually I just tried it in a Windows REPL and fs.mkdirSync and fs.writeFileSync handle forward slashes correctly). So I wonder what the actual issue is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants