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

Fix path mangling when .js is a substring e.g. foo.jszip.js #282

Open
pulver opened this issue Dec 2, 2024 · 0 comments
Open

Fix path mangling when .js is a substring e.g. foo.jszip.js #282

pulver opened this issue Dec 2, 2024 · 0 comments

Comments

@pulver
Copy link

pulver commented Dec 2, 2024

The importmap path is incorrect when .js is a substring of the module path.

Reproduction

Add to config/importmap.rb:

pin_all_from 'app/javascript/test', under: 'test'

Add to app/javascript/application.js:

import 'test/foo.jszip'

Create file app/javascript/test/foo.jszip.js with content:

export function asdf() { return 3; }

Run:

$ RAILS_ENV=production bin/rails assets:clobber
$ RAILS_ENV=production bin/rails assets:precompile --trace

Test:

$ RAILS_ENV=production bin/importmap json|grep foo
    "test/foozip": "/assets/test/foo.jszip-2be366e5912d407e15016b08dd7eedbdf5b28865f4d003766b4c47052cab606c.js"

Problem

The "test/foozip" path is incorrect.

It is expected to be "test/foo.jszip".

It appears there is code somewhere that is removing .js from the middle of the path rather than just the end.

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

1 participant