Unverified Commit d8623bb9 authored by Shu Ding's avatar Shu Ding Committed by GitHub

Use eager import to include client modules (#35979)

Eager import does almost the same thing as `require()` but it instead also supports loading an ES module.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
parent 5feb400a
...@@ -238,7 +238,12 @@ export default async function transformSource( ...@@ -238,7 +238,12 @@ export default async function transformSource(
__webpack_require__, __webpack_require__,
_: () => { _: () => {
${imports ${imports
.map((importSource) => `require('${importSource}');`) .map(
(importSource) =>
`import(/* webpackMode: "eager" */ ${JSON.stringify(
importSource
)});`
)
.join('\n')} .join('\n')}
}, },
server: ${isServerExt ? 'true' : 'false'} server: ${isServerExt ? 'true' : 'false'}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment