Skip to content

Commit 747f54c

Browse files
committed
fix: set platform to node for CJS format
closes #259
1 parent 8547406 commit 747f54c

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ async function getBuildOptions(
267267
tsconfigFilename: tsconfig || undefined,
268268
},
269269
treeshake,
270-
platform,
270+
platform: cjsDts || format === 'cjs' ? 'node' : platform,
271271
define: {
272272
...define,
273273
...Object.keys(env).reduce((acc, key) => {

tests/__snapshots__/shims-cjs-on-neutral-w-o-shims.snap.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
var shims_cjs_on_neutral_w_o_shims_default = [
77
__dirname,
88
__filename,
9-
import.meta.url,
10-
import.meta.filename,
11-
import.meta.dirname,
9+
require("url").pathToFileURL(__filename).href,
10+
__filename,
11+
__dirname,
1212
void 0
1313
];
1414

tests/shims.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('shims', () => {
3434
expect(snapshot).not.contain('import.meta')
3535
})
3636

37-
test.fails('cjs on neutral w/o shims', async (context) => {
37+
test('cjs on neutral w/o shims', async (context) => {
3838
const { snapshot } = await testBuild({
3939
context,
4040
files: { 'index.ts': code },

0 commit comments

Comments
 (0)