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

`import(./${'foo'}/index.js)` fails #15763

Closed
7 tasks done
wmertens opened this issue Jan 31, 2024 · 2 comments
Closed
7 tasks done

`import(./${'foo'}/index.js)` fails #15763

wmertens opened this issue Jan 31, 2024 · 2 comments
Labels
duplicate This issue or pull request already exists

Comments

@wmertens
Copy link
Contributor

wmertens commented Jan 31, 2024

Describe the bug

import(`./${'foo'}/index.js`) fails (it complains that it can't decypher the dynamic import) but import(`./`+'foo'+`/index.js`) is fine. This happens when importing from a replaced environment variable.

Reproduction

see above

Steps to reproduce

use a defined-d variable in an import

System Info

System:
    OS: Linux 6.1 NixOS 24.05 (Uakari) 24.05 (Uakari)
    CPU: (8) x64 Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz
    Memory: 1.85 GB / 15.20 GB
    Container: Yes
    Shell: 5.2.21 - /run/current-system/sw/bin/bash
  Binaries:
    Node: 20.9.0 - /nix/store/a1hckfqzyys4rfgbdy5kmb5w0zdr55i5-nodejs-20.9.0/bin/node
    npm: 10.1.0 - /nix/store/a1hckfqzyys4rfgbdy5kmb5w0zdr55i5-nodejs-20.9.0/bin/npm
    pnpm: 8.15.1 - /nix/store/3kw9mkkwjd69jaqp5la66g10y7wckq2s-corepack-nodejs-20.9.0/bin/pnpm
  npmPackages:
    vite: ^5.0.12 => 5.0.12

Used Package Manager

pnpm

Logs

No response

Validations

@wmertens wmertens changed the title import(./${'foo'}/index.js) fails `import(./${'foo'}/index.js)` fails Jan 31, 2024
@wmertens wmertens changed the title `import(./${'foo'}/index.js)` fails import(\./${'foo'}/index.js\) fails Jan 31, 2024
@wmertens wmertens changed the title import(\./${'foo'}/index.js\) fails `import(./${'foo'}/index.js)` fails Jan 31, 2024
@XiSenao
Copy link
Collaborator

XiSenao commented Jan 31, 2024

rollup does not seem to support similar parsing either, you may need to use it as guided by the prompts.

@sapphi-red
Copy link
Member

Duplicate of #15864

@sapphi-red sapphi-red marked this as a duplicate of #15864 Feb 11, 2024
@sapphi-red sapphi-red closed this as not planned Won't fix, can't repro, duplicate, stale Feb 11, 2024
@sapphi-red sapphi-red added duplicate This issue or pull request already exists and removed pending triage labels Feb 11, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Feb 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants