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

Webpack complains about dynamic imports #596

Open
TrejGun opened this issue Jun 21, 2023 · 0 comments
Open

Webpack complains about dynamic imports #596

TrejGun opened this issue Jun 21, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@TrejGun
Copy link

TrejGun commented Jun 21, 2023

Bug Description
A clear and concise description of the bug.

Steps to Reproduce

  1. Buils project using webpack
WARNING in ../../node_modules/@uniswap/widgets/dist/cjs/index-4f48ae8b.cjs 21221:117-155
Critical dependency: the request of a dependency is an expression
    at CommonJsRequireContextDependency.getWarnings (~/node_modules/webpack/lib/dependencies/ContextDependency.js:104:18)
    at Compilation.reportDependencyErrorsAndWarnings (~/node_modules/webpack/lib/Compilation.js:3140:24)
    at ~/node_modules/webpack/lib/Compilation.js:2737:28
    at eval (eval at create (~/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:29:1)
    at ~/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:380:10
    at ~/node_modules/neo-async/async.js:2830:7
    at Object.each (~/node_modules/neo-async/async.js:2850:39)
    at ~/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:356:17
    at ~/node_modules/neo-async/async.js:2830:7
    at Object.each (~/node_modules/neo-async/async.js:2850:39)

The error is caused by the dynamic import in this line
https://github.com/Uniswap/widgets/blob/main/src/i18n.tsx#L82

image

According to the doc, this error can be eliminated by adding a special comment

const catalog = await import(/* webpackPrefetch: true */ `./locales/${locale}.js`)

https://webpack.js.org/guides/code-splitting/#dynamic-imports

Expected Behavior
No warnings at compile time

Additional Context
Add any other context about the problem here (screenshots, whether the bug only occurs only in certain mobile/desktop/browser environments, etc.)

@TrejGun TrejGun added the bug Something isn't working label Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant