-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix shared chunk extension along with parent chunk (#570)
- Loading branch information
Showing
8 changed files
with
61 additions
and
6 deletions.
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
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
2 changes: 1 addition & 1 deletion
2
test/compile/use-client/__snapshot__/use-client.min.js.snapshot
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 |
---|---|---|
@@ -1 +1 @@ | ||
"use strict";import{c as t}from"./client-client-B-RDfYre.js";var e=()=>t();export{e as default}; | ||
"use strict";import{c as t}from"./client-client-B-RDfYre.mjs";var e=()=>t();export{e as default}; |
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,29 @@ | ||
import { promises as fsp } from 'fs' | ||
import { createIntegrationTest } from '../utils' | ||
import path from 'path' | ||
|
||
describe('integration shared-module-ts-esm', () => { | ||
it('should contain correct type file path of shared chunks', async () => { | ||
await createIntegrationTest( | ||
{ | ||
directory: __dirname, | ||
}, | ||
async ({ distDir }) => { | ||
const cjsFiles = await fsp.readdir(path.join(distDir, 'cjs')) | ||
const esmFiles = await fsp.readdir(path.join(distDir, 'es')) | ||
|
||
expect(cjsFiles).toEqual( | ||
expect.arrayContaining([ | ||
expect.stringMatching(/util-shared-\w+\.js/), | ||
]), | ||
) | ||
|
||
expect(esmFiles).toEqual( | ||
expect.arrayContaining([ | ||
expect.stringMatching(/util-shared-\w+\.mjs/), | ||
]), | ||
) | ||
}, | ||
) | ||
}) | ||
}) |
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,18 @@ | ||
{ | ||
"name": "shared-module-ts-esm", | ||
"exports": { | ||
".": { | ||
"import": { | ||
"types": "./dist/es/index.d.mts", | ||
"default": "./dist/es/index.mjs" | ||
}, | ||
"require": { | ||
"types": "./dist/cjs/index.d.ts", | ||
"default": "./dist/cjs/index.js" | ||
} | ||
} | ||
}, | ||
"dependencies": { | ||
"react": "*" | ||
} | ||
} |
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 @@ | ||
export const index = 'index' | ||
export { sharedApi } from './lib/util.shared-runtime' |
3 changes: 3 additions & 0 deletions
3
test/integration/shared-module-ts-esm/src/lib/util.shared-runtime.ts
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,3 @@ | ||
export function sharedApi() { | ||
return 'common:shared' | ||
} |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "shared-module", | ||
"name": "shared-module-ts", | ||
"type": "module", | ||
"exports": { | ||
".": { | ||
|