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

[dynamic-import-chunkname] webpackChunkName should be optional when webpackMode: "eager" #1904

Open
dtinth opened this issue Sep 18, 2020 · 0 comments

Comments

@dtinth
Copy link

dtinth commented Sep 18, 2020

Code

import(
  /* webpackMode: "eager" */ '../a-module-that-requires-some-time-to-initialize'
)

Expected result

(No warning)

Actual result

dynamic imports require a leading comment in the form /* webpackChunkName: "[a-zA-Z0-9-/_]+",? */ eslint(import/dynamic-import-chunkname)

Description

From the docs:

'eager': Generates no extra chunk. All modules are included in the current chunk and no additional network requests are made. A Promise is still returned but is already resolved. In contrast to a static import, the module isn't executed until the call to import() is made.

/* webpackMode: "eager" */ is handy when you want to include a module in the same chunk, but do not want to execute it when the chunk is initially loaded.

Workaround

// See https://github.com/benmosher/eslint-plugin-import/issues/1904
// eslint-disable-next-line import/dynamic-import-chunkname
import(
  /* webpackMode: "eager" */ '../a-module-that-requires-some-time-to-initialize'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants