@@ -188,10 +188,13 @@ function createCJSModuleWrap(url, source, isMain, format, loadCJS = loadCJSModul
|
188 | 188 | const { exportNames, module } = cjsPreparseModuleExports(filename, source, format); |
189 | 189 | cjsCache.set(url, module); |
190 | 190 | |
191 | | -const wrapperNames = [...exportNames, 'module.exports']; |
| 191 | +const wrapperNames = [...exportNames]; |
192 | 192 | if (!exportNames.has('default')) { |
193 | 193 | ArrayPrototypePush(wrapperNames, 'default'); |
194 | 194 | } |
| 195 | +if (!exportNames.has('module.exports')) { |
| 196 | +ArrayPrototypePush(wrapperNames, 'module.exports'); |
| 197 | +} |
195 | 198 | |
196 | 199 | if (isMain) { |
197 | 200 | setOwnProperty(process, 'mainModule', module); |
@@ -212,7 +215,8 @@ function createCJSModuleWrap(url, source, isMain, format, loadCJS = loadCJSModul
|
212 | 215 | ({ exports } = module); |
213 | 216 | } |
214 | 217 | for (const exportName of exportNames) { |
215 | | -if (!ObjectPrototypeHasOwnProperty(exports, exportName) || exportName === 'default') { |
| 218 | +if (exportName === 'default' || exportName === 'module.exports' || |
| 219 | +!ObjectPrototypeHasOwnProperty(exports, exportName)) { |
216 | 220 | continue; |
217 | 221 | } |
218 | 222 | // We might trigger a getter -> dont fail. |
|