Skip to content

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

Open
@pulver

Description

@pulver

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions