-
Notifications
You must be signed in to change notification settings - Fork 30
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 db0990e
Showing
6 changed files
with
110 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
35 changes: 35 additions & 0 deletions
35
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,35 @@ | ||
// 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(); | ||
export var a = __named_exports_for_vite['a']; | ||
export var b = __named_exports_for_vite['b']; | ||
export var o1 = __named_exports_for_vite['o1']; | ||
export var o2 = __named_exports_for_vite['o2']; | ||
export var c = __named_exports_for_vite['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