mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
```
// This is only used by Webpack to correctly output the manifest. It's value shouldn't be relied
// upon externally. It's possible that the same action can be in different layers in a single
// page, which cannot be modelled with this API anyway.
```
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import {
|
|
nextTestSetupActionTreeShaking,
|
|
getActionsRoutesStateByRuntime,
|
|
} from '../_testing/utils'
|
|
|
|
// TODO: revisit when we have a better side-effect free transform approach for server action
|
|
;(process.env.IS_TURBOPACK_TEST ? describe : describe.skip)(
|
|
'actions-tree-shaking - mixed-module-actions',
|
|
() => {
|
|
const { next } = nextTestSetupActionTreeShaking({
|
|
files: __dirname,
|
|
})
|
|
|
|
it('should not do tree shake for cjs module when import server actions', async () => {
|
|
const actionsRoutesState = await getActionsRoutesStateByRuntime(next)
|
|
expect(actionsRoutesState).toMatchInlineSnapshot(`
|
|
{
|
|
"app/mixed-module/cjs/page": [
|
|
"app/mixed-module/cjs/actions.js#cjsModuleTypeAction",
|
|
"app/mixed-module/cjs/actions.js#esmModuleTypeAction",
|
|
"app/mixed-module/cjs/actions.js#unusedModuleTypeAction1",
|
|
],
|
|
"app/mixed-module/esm/page": [
|
|
"app/mixed-module/esm/actions.js#cjsModuleTypeAction",
|
|
"app/mixed-module/esm/actions.js#esmModuleTypeAction",
|
|
"app/mixed-module/esm/actions.js#unusedModuleTypeAction1",
|
|
],
|
|
}
|
|
`)
|
|
})
|
|
}
|
|
)
|