Skip to content

Commit ec86d70

Browse files
authored
docs: add webpackIgnore for new URL() (#7366)
1 parent 219d805 commit ec86d70

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/content/api/module-methods.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,16 @@ import(
136136

137137
```js
138138
import(/* webpackIgnore: true */ 'ignored-module.js');
139+
140+
new URL(/* webpackIgnore: true */ 'file1.css', import.meta.url);
139141
```
140142
141143
##### `webpackIgnore`
142144
143145
Disables dynamic import parsing when set to `true`.
144146
147+
When using `import.meta.url`, it does not remain as-is; instead, it gets replaced based on the `baseURI`. For modules, it is replaced with `new URL("./", import.meta.url)`, and for other cases, it defaults to `document.baseURI`. This ensures that relative URLs work correctly, aligning with the base URL context.
148+
145149
W> Note that setting `webpackIgnore` to `true` opts out of code splitting.
146150
147151
##### `webpackChunkName`

0 commit comments

Comments
 (0)