Skip to content

Commit a675b3f

Browse files
committed
chore: update
1 parent 5e02019 commit a675b3f

File tree

5 files changed

+33
-0
lines changed

5 files changed

+33
-0
lines changed

pnpm-lock.yaml

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "format-esm-eval-test",
3+
"version": "1.0.0",
4+
"private": true,
5+
"type": "module"
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { defineConfig } from '@rslib/core';
2+
import { generateBundleEsmConfig } from 'test-helper';
3+
4+
export default defineConfig({
5+
lib: [generateBundleEsmConfig({})],
6+
});
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export const foo = 'foo';
2+
3+
export function evalFunc() {
4+
return eval('1');
5+
}

tests/integration/format/index.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,17 @@ test('`module` should be correctly handled by `parserOptions.commonjs.exports =
134134
expect(typeof cjsOutput.default.path1.basename).toBe('function');
135135
expect(cjsOutput.default.path1).toBe(cjsOutput.default.path2);
136136
});
137+
138+
test.skipIf(!process.env.ADVANCED_ESM)(
139+
'ESM with eval should export correctly',
140+
async () => {
141+
const fixturePath = path.resolve(__dirname, 'esm-eval');
142+
const { entryFiles } = await buildAndGetResults({
143+
fixturePath,
144+
});
145+
146+
const esmOutput = await import(entryFiles.esm);
147+
expect(esmOutput.evalFunc()).toBe(1);
148+
expect(esmOutput.foo).toBe('foo');
149+
},
150+
);

0 commit comments

Comments
 (0)