forked from rolldown/rolldown
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(splitting): ensure correct __export symbol reference (rolldown#3289)
<!-- Thank you for contributing! --> ### Description close rolldown#3288 <!-- Please insert your description here and provide especially info about the "what" this PR is solving -->
- Loading branch information
Showing
7 changed files
with
103 additions
and
18 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
18 changes: 18 additions & 0 deletions
18
crates/rolldown/tests/rolldown/code_splitting/format_cjs_with_esm_require_esm/_config.json
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,18 @@ | ||
{ | ||
"config": { | ||
"input": [ | ||
{ | ||
"name": "main1", | ||
"import": "main1.js" | ||
}, | ||
{ | ||
"name": "main2", | ||
"import": "main2.js" | ||
} | ||
], | ||
"external": [ | ||
"node:assert" | ||
], | ||
"format":"cjs" | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
crates/rolldown/tests/rolldown/code_splitting/format_cjs_with_esm_require_esm/artifacts.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,57 @@ | ||
--- | ||
source: crates/rolldown_testing/src/integration_test.rs | ||
snapshot_kind: text | ||
--- | ||
# Assets | ||
|
||
## chunk.js | ||
|
||
```js | ||
"use strict"; | ||
Object.defineProperty(exports, '__esm', { | ||
enumerable: true, | ||
get: function () { | ||
return __esm; | ||
} | ||
}); | ||
Object.defineProperty(exports, '__export', { | ||
enumerable: true, | ||
get: function () { | ||
return __export; | ||
} | ||
}); | ||
Object.defineProperty(exports, '__toESM', { | ||
enumerable: true, | ||
get: function () { | ||
return __toESM; | ||
} | ||
}); | ||
``` | ||
## main1.js | ||
|
||
```js | ||
const require_chunk = require('./chunk.js'); | ||
require("node:assert"); | ||
``` | ||
## main2.js | ||
|
||
```js | ||
const require_chunk = require('./chunk.js'); | ||
//#region esm.js | ||
var esm_exports = {}; | ||
require_chunk.__export(esm_exports, { share: () => share }); | ||
function share() { | ||
return 1; | ||
} | ||
var init_esm = require_chunk.__esm({ "esm.js"() {} }); | ||
//#endregion | ||
//#region main2.js | ||
init_esm(); | ||
//#endregion | ||
``` |
3 changes: 3 additions & 0 deletions
3
crates/rolldown/tests/rolldown/code_splitting/format_cjs_with_esm_require_esm/esm.js
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,3 @@ | ||
export function share() { | ||
return 1 | ||
} |
1 change: 1 addition & 0 deletions
1
crates/rolldown/tests/rolldown/code_splitting/format_cjs_with_esm_require_esm/main1.js
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 @@ | ||
import assert from 'node:assert' |
1 change: 1 addition & 0 deletions
1
crates/rolldown/tests/rolldown/code_splitting/format_cjs_with_esm_require_esm/main2.js
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 @@ | ||
require('./esm'); |
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