You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add resolved sources to shouldTransformCachedModule (#4414)
* Add dependencies to shouldTransform hook
* Test errors in shouldTransform are handled correctly
* Provide resolvedSources instead of importedIds
* Add documentation
Copy file name to clipboardExpand all lines: docs/05-plugin-development.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -266,7 +266,7 @@ In watch mode or when using the cache explicitly, the resolved imports of a cach
266
266
267
267
#### `shouldTransformCachedModule`
268
268
269
-
**Type:**`({id: string, code: string, ast: ESTree.Program, meta: {[plugin: string]: any}, moduleSideEffects: boolean | "no-treeshake", syntheticNamedExports: string | boolean}) => boolean`<br> **Kind:**`async, first`<br> **Previous Hook:**[`load`](guide/en/#load) where the cached file was loaded to compare its code with the cached version.<br> **Next Hook:**[`moduleParsed`](guide/en/#moduleparsed) if no plugin returns `true`, otherwise [`transform`](guide/en/#transform).
269
+
**Type:**`({id: string, code: string, ast: ESTree.Program, resoledSources: {[source: string]: ResolvedId}, meta: {[plugin: string]: any}, moduleSideEffects: boolean | "no-treeshake", syntheticNamedExports: string | boolean}) => boolean`<br> **Kind:**`async, first`<br> **Previous Hook:**[`load`](guide/en/#load) where the cached file was loaded to compare its code with the cached version.<br> **Next Hook:**[`moduleParsed`](guide/en/#moduleparsed) if no plugin returns `true`, otherwise [`transform`](guide/en/#transform).
270
270
271
271
If the Rollup cache is used (e.g. in watch mode or explicitly via the JavaScript API), Rollup will skip the [`transform`](guide/en/#transform) hook of a module if after the [`load`](guide/en/#transform) hook, the loaded `code` is identical to the code of the cached copy. To prevent this, discard the cached copy and instead transform a module, plugins can implement this hook and return `true`.
0 commit comments