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

Question: alias doesnt match against the whole import (but replaces partials too) #2963

Closed
mhsdesign opened this issue Mar 2, 2023 · 2 comments

Comments

@mhsdesign
Copy link

in webpack (4) i was able to sucessfully use their "resolve" feature to archive the following: mapping my imports to a shim.

{
    "redux-saga/effects": "@neos-project/neos-ui-extensibility/dist/shims/vendor/redux-saga-effects/index",
    "redux-saga": "@neos-project/neos-ui-extensibility/dist/shims/vendor/redux-saga/index",
}

i personally would expect that this map would also work with the esbuild alias feature.
But my assumption is wrong, i thought redux-saga would be handled like this /^redux-saga\/?$/ but the import is also replaced for this case:

import { take } from "redux-saga/effects"

will become

import { take } from "@neos-project/neos-ui-extensibility/dist/shims/vendor/redux-saga/index/effects"

(which i dindt anticipate for now)

it seems my first alias redux-saga/effects is not used but redux-saga will take effect and the effects subfolder/file is appended ...

maybe its a feature though ^^ i mean i could just adjust my code, but wanted to ask if this behaviour is intended.

@evanw
Copy link
Owner

evanw commented Mar 3, 2023

Thanks for the report. This is actually a determinism issue as esbuild stops when it encounters the first match instead of checking all of them and taking the longest match. So this is definitely a bug with esbuild.

@evanw evanw closed this as completed in 1978946 Mar 3, 2023
@mhsdesign
Copy link
Author

Thank you for fixing it and your efforts ❤️

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