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
Copy file name to clipboardExpand all lines: packages/commonjs/README.md
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -68,6 +68,8 @@ You can also provide a [minimatch pattern](https://github.com/isaacs/minimatch),
68
68
Type: `string | string[]`<br>
69
69
Default: `[]`
70
70
71
+
_Note: In previous versions, this option would spin up a rather comprehensive mock environment that was capable of handling modules that manipulate `require.cache`. This is no longer supported. If you rely on this e.g. when using request-promise-native, use version 21 of this plugin._
72
+
71
73
Some modules contain dynamic `require` calls, or require modules that contain circular dependencies, which are not handled well by static imports.
72
74
Including those modules as `dynamicRequireTargets` will simulate a CommonJS (NodeJS-like) environment for them with support for dynamic dependencies. It also enables `strictRequires` for those modules, see above.
'It appears a plugin has implemented a "resolveId" hook that uses "this.resolve" without forwarding the third "options" parameter of "resolveId". This is problematic as it can lead to wrong module resolutions especially for the node-resolve plugin and in certain cases cause early exit errors for the commonjs plugin.\nIn rare cases, this warning can appear if the same file is both imported and required from the same mixed ES/CommonJS module, in which case it can be ignored.',
79
+
url: 'https://rollupjs.org/guide/en/#resolveid'
80
+
});
81
+
returnnull;
82
+
}
83
+
84
+
if(isWrappedId(importee,WRAPPED_SUFFIX)){
85
+
returnunwrapId(importee,WRAPPED_SUFFIX);
86
+
}
75
87
76
-
if(importer){
77
88
if(
78
-
importer===DYNAMIC_MODULES_ID||
79
-
// Proxies are only importing resolved ids, no need to resolve again
80
-
isWrappedId(importer,PROXY_SUFFIX)||
81
-
isWrappedId(importer,ES_IMPORT_SUFFIX)||
82
-
importer.endsWith(ENTRY_SUFFIX)
89
+
importee.endsWith(ENTRY_SUFFIX)||
90
+
isWrappedId(importee,MODULE_SUFFIX)||
91
+
isWrappedId(importee,EXPORTS_SUFFIX)||
92
+
isWrappedId(importee,PROXY_SUFFIX)||
93
+
isWrappedId(importee,ES_IMPORT_SUFFIX)||
94
+
isWrappedId(importee,EXTERNAL_SUFFIX)||
95
+
importee.startsWith(HELPERS_ID)||
96
+
importee===DYNAMIC_MODULES_ID
83
97
){
84
98
returnimportee;
85
99
}
86
-
if(isWrappedId(importer,EXTERNAL_SUFFIX)){
87
-
// We need to return null for unresolved imports so that the proper warning is shown
'It appears a plugin has implemented a "resolveId" hook that uses "this.resolve" without forwarding the third "options" parameter of "resolveId". This is problematic as it can lead to wrong module resolutions especially for the node-resolve plugin and in certain cases cause early exit errors for the commonjs plugin.\nIn rare cases, this warning can appear if the same file is both imported and required from the same mixed ES/CommonJS module, in which case it can be ignored.'
0 commit comments