Skip to content

Don't warn for import of optional dependencies#15688

Closed
schickling wants to merge 1 commit intowebpack:mainfrom
schickling-test:fix/warn-optional-import
Closed

Don't warn for import of optional dependencies#15688
schickling wants to merge 1 commit intowebpack:mainfrom
schickling-test:fix/warn-optional-import

Conversation

@schickling
Copy link
Copy Markdown

Based on @sokra's suggestion, this PR silences warnings like the below of import statements of optional dependencies.

image

image

@linux-foundation-easycla
Copy link
Copy Markdown

CLA Not Signed

@webpack-bot
Copy link
Copy Markdown
Contributor

For maintainers only:

  • This needs to be documented (issue in webpack/webpack.js.org will be filed when merged)
  • This needs to be backported to webpack 4 (issue will be created when merged)

Copy link
Copy Markdown
Member

@sokra sokra left a comment

Choose a reason for hiding this comment

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

We need a test case for that

context,
path: dependency,
expected: undefined,
expected: false,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Only set this to false for the import() case, which is the if (imp.d > -1) case a few lines above.

@inflation
Copy link
Copy Markdown

It's really annoying to see these warnings.

@hen-den
Copy link
Copy Markdown

hen-den commented Oct 5, 2024

Would it be possible to resolve this warning? It's not critical, but it does clutter the build process with warning messages.

In my case I get the following warning:

Warning

<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Parsing of /Users/.../node_modules/velite/dist/velite-B_2ACfq8.js for build dependencies failed at 'import(configUrl.href)'. <w> Build dependencies behind this expression are ignored and might cause incorrect cache invalidation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants