Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

The support for trailing $ #53

Open
vmajsuk opened this issue Oct 22, 2017 · 0 comments
Open

The support for trailing $ #53

vmajsuk opened this issue Oct 22, 2017 · 0 comments

Comments

@vmajsuk
Copy link

vmajsuk commented Oct 22, 2017

Hi!

In the webpack docs for resolve.alias there is an option to resolve a specific file by doing this:

resolve: {
    alias: { xyz$: 'path/to/xyz.js' }
}

, and then using it in the code like

import xyz from 'xyz'

However, that does not work with the plugin.
What does work is to have a webpack config like this:

resolve: {
    alias: { xyz: 'path/to/xyz.js' }
}

, and using it like this:

import xyz from 'xyz'

This is caused by the following line in the src/index.js:176, I think:

let requiredFilePath = filePath.replace(aliasFrom, relativeFilePath);

I can submit a pr, but I'm just not sure what kind of behavior is expected.
Maybe the correct way is checking if aliasFrom ends with $, and, in case it does and the path starts with aliasFrom.slice(1), do filePath.replace(aliasFrom.slice(1), relativeFilePath), so the module remains backward compatible?
Or just add the description of the workaround to the README.md?

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

No branches or pull requests

1 participant