Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle shimming missing exports when preserving modules (#4971)
- Loading branch information
1 parent
5628d16
commit 14e9d2d
Showing
4 changed files
with
27 additions
and
1 deletion.
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
19 changes: 19 additions & 0 deletions
19
test/function/samples/missing-export-preserve-modules/_config.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,19 @@ | ||
const path = require('node:path'); | ||
|
||
module.exports = defineTest({ | ||
description: 'supports shimming missing exports when preserving modules', | ||
options: { | ||
shimMissingExports: true, | ||
output: { | ||
preserveModules: true | ||
} | ||
}, | ||
warnings: [ | ||
{ | ||
binding: 'bar', | ||
code: 'SHIMMED_EXPORT', | ||
exporter: path.join(__dirname, 'foo.js'), | ||
message: 'Missing export "bar" has been shimmed in module "foo.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 @@ | ||
export const foo = 'foo'; |
2 changes: 2 additions & 0 deletions
2
test/function/samples/missing-export-preserve-modules/main.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,2 @@ | ||
import { bar } from './foo'; | ||
assert.strictEqual(bar, undefined); |