Skip to content

Commit 292d17d

Browse files
Add support for NodeJS require() syntax (#208)
* Add support for NodeJS require() syntax
1 parent 70ebd9b commit 292d17d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

__TESTS__/unit/scripts/createEntryPoints.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ describe('Tests for createEntryPoints', () => {
1818
const mainPackageJson = JSON.parse(fs.readFileSync('./dist/package.json', 'utf-8'));
1919

2020
// Expect the right main entrypoint
21-
expect(mainPackageJson.main).toBe('./index.js');
21+
expect(mainPackageJson.main).toBe('./bundles/umd/base.js');
22+
expect(mainPackageJson.browser).toBe('./index.js');
2223
// Expect not to delete existing values
2324
expect(mainPackageJson.fieldA).toBe('foobar');
2425
expect(mainPackageJson.sideEffects).toBe(false);

scripts/lib/entryPointsLib.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ function createMainEntryPoint() {
3636
const projectJson = JSON.parse(fs.readFileSync('./package.json', 'utf-8'));
3737
delete projectJson.scripts;
3838
delete projectJson.devDependencies;
39-
projectJson.main = './index.js';
39+
projectJson.main = './bundles/umd/base.js';
40+
projectJson.browser = './index.js';
4041

4142
Object.assign(projectJson, commonPackageProperties);
4243
fs.writeFileSync('./dist/package.json', JSON.stringify(projectJson, null, '\t'));

0 commit comments

Comments
 (0)