swc/node-swc/__tests__/spack/multi_entry_test.js
강동윤 31020e46d8
spack: enhancement (#845)
- Handle modules (via swcrc)
 - swc.bundle([conf1, conf2])
 - Correct chunking
2020-06-15 23:28:15 +09:00

34 lines
1.1 KiB
JavaScript

const swc = require("../../..");
const path = require('path');
it('should handle multiple entries on same level', async () => {
const result = await swc.bundle({
entry: {
a: path.join(__dirname, '../../tests/spack/mutli-entry-same-level/src/a.js'),
b: path.join(__dirname, '../../tests/spack/mutli-entry-same-level/src/b.js'),
}
});
expect(result.a).toBeTruthy();
expect(result.a.code).toContain(`import { foo } from './common-`);
expect(result.b).toBeTruthy();
expect(result.b.code).toContain(`import { foo } from './common-`);
});
it('should handle multiple entries on different level', async () => {
const result = await swc.bundle({
entry: {
web: path.join(__dirname, '../../tests/spack/mutli-entry-different-level/src/web/index.js'),
a: path.join(__dirname, '../../tests/spack/mutli-entry-different-level/src/a.js'),
}
});
expect(result.a).toBeTruthy();
expect(result.a.code).toContain(`import { foo } from './common-`);
expect(result.web).toBeTruthy();
expect(result.web.code).toContain(`../common`);
});