-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(commonjs): add named exports option
- Loading branch information
1 parent
70ae949
commit 9959c79
Showing
6 changed files
with
123 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
packages/vite-plugin-commonjs/__tests__/__snapshots__/transform.spec.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`transform named exports 1`] = ` | ||
"var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __commonJS = (cb, mod) => function __require() { | ||
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; | ||
}; | ||
var require_stdin = __commonJS({ | ||
\\"<stdin>\\"(exports, module) { | ||
const a = \\"a\\"; | ||
const obj = { | ||
o1: 1, | ||
o2: 2 | ||
}; | ||
module.exports = { | ||
a, | ||
b: \\"b\\", | ||
...obj | ||
}; | ||
exports.c = \\"c\\"; | ||
} | ||
}); | ||
var __named_exports_for_vite = require_stdin(); | ||
var __named_exports_for_vite__a = __named_exports_for_vite['a']; | ||
var __named_exports_for_vite__b = __named_exports_for_vite['b']; | ||
var __named_exports_for_vite__o1 = __named_exports_for_vite['o1']; | ||
var __named_exports_for_vite__o2 = __named_exports_for_vite['o2']; | ||
var __named_exports_for_vite__c = __named_exports_for_vite['c']; | ||
export {__named_exports_for_vite__a as a,__named_exports_for_vite__b as b,__named_exports_for_vite__o1 as o1,__named_exports_for_vite__o2 as o2,__named_exports_for_vite__c as c}; | ||
export default __named_exports_for_vite; | ||
" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters