-
-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Open
Labels
p2-edge-caseBug, but has workaround or limited in scope (priority)Bug, but has workaround or limited in scope (priority)
Description
Describe the bug
Variable dynamic imports such as import(`./inc/${name}.js`)
that appears in a dependency are not transpiled at all.
Maybe related to #1903.
Reproduction
https://github.com/balthild/vrt-esmdi
/testlib2
- The dependency that contains variable dynamic imports/app
- A vite app/app/es
- A copy of/testlib2/es
Step
- Clone the repo
cd vrt-esmdi/app
yarn && yarn build
- Check the build output in
dist
and you can find that there's nothing corresponding to/testlib2/es/inc/*.js
which is dynamically imported. - Edit
/app/main.js
and change the first line toimport { testImport } from './es';
yarn build
- Check the build output and you can find that the dynamically imported scripts are there.
Since the contents of /testlib2/es
and /app/es
are identical, so I think the import expressions are treated differently when they're in the app or in a dependency.
System Info
System:
OS: Linux 4.19 Debian GNU/Linux 10 (buster) 10 (buster)
CPU: (4) x64 Intel(R) Xeon(R) CPU E5-2696 v2 @ 2.50GHz
Memory: 3.38 GB / 7.79 GB
Container: Yes
Shell: 5.0.3 - /bin/bash
Binaries:
Node: 16.13.1 - /usr/bin/node
Yarn: 1.22.17 - /usr/bin/yarn
npm: 8.1.2 - /usr/bin/npm
Used Package Manager
yarn
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
jhuesos, igrep, elpddev and gyurielf
Metadata
Metadata
Assignees
Labels
p2-edge-caseBug, but has workaround or limited in scope (priority)Bug, but has workaround or limited in scope (priority)
Type
Projects
Status
Approved