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

fix: dynamic import warning with @vite-ignore #7533

Merged
merged 1 commit into from
Mar 31, 2022

Conversation

patak-dev
Copy link
Member

Description

#7357 update es-module-lexer to 0.10.1 (changelog), and we missed that the @vite-ignore change was broken after this.


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

@patak-dev patak-dev requested review from bluwy and antfu March 30, 2022 23:12
@patak-dev patak-dev added the p3-minor-bug An edge case that only affects very specific usage (priority) label Mar 30, 2022
Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah thanks for catching this

@patak-dev patak-dev merged commit 29c1ec0 into main Mar 31, 2022
@patak-dev patak-dev deleted the fix/dynamic-import-vite-ignore-warning branch March 31, 2022 05:03
@adamdehaven
Copy link

adamdehaven commented Jan 25, 2023

@patak-dev this issue has surfaced again.

image

Related code:

await import(/* @vite-ignore */ url)

As of vite@4.0.4

@aevitas1
Copy link

aevitas1 commented Jun 4, 2023

Is there any workaround for this?

One of my pages gets 100+ errors now when it's loaded.

@patak-dev
Copy link
Member Author

Please create a new issue with a minimal reproduction against latest, and you can link this PR as reference. Your reports will not be correctly tracked if you comment on a closed pull request.

@jcalfee
Copy link

jcalfee commented Nov 28, 2024

I put the /* @vite-ignore */ after the code withing the "import()" call and see this warning is still happening in ^2.1.6. Until we have a reproducible repository, maybe there should be a way to disable the warning all together until it is stable.

[dev:solid] 146|  async function importMigration(folder, fileName) {
[dev:solid] 147|    const mg = (await import(resolveFrom(process.cwd(), folder + '/' + fileName) /* @vite-ignore */)).default;
[dev:solid]    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[dev:solid] 148|    if (typeof mg !== 'function') {
[dev:solid] 149|      throw new Error(`Expecting "export default [async] function([ddlClient])" in ${fileName}`);
[dev:solid] The above dynamic import cannot be analyzed by Vite.
[dev:solid] See https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars#limitations for supported dynamic import formats. If this is intended to be left as-is, you can use the /* @vite-ignore */ comment inside the import() call to suppress this warning.
[dev:solid] 
[dev:solid]   Plugin: vite:import-analysis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants