Skip to content

Commit

Permalink
Revert "Fix bundling of Server Actions (#51367)"
Browse files Browse the repository at this point in the history
This reverts commit 4698138.
  • Loading branch information
ijjk committed Jun 16, 2023
1 parent cd68352 commit 9f810e1
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 24 deletions.
4 changes: 2 additions & 2 deletions packages/next/src/build/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1385,7 +1385,7 @@ export default async function getBaseWebpackConfig(
// so that the DefinePlugin can inject process.env values.

// Treat next internals as non-external for server layer
if (layer === WEBPACK_LAYERS.server || layer === WEBPACK_LAYERS.action) {
if (layer === WEBPACK_LAYERS.server) {
return
}

Expand Down Expand Up @@ -1520,7 +1520,7 @@ export default async function getBaseWebpackConfig(
(isEsm && isAppLayer)

if (/node_modules[/\\].*\.[mc]?js$/.test(res)) {
if (layer === WEBPACK_LAYERS.server || layer === WEBPACK_LAYERS.action) {
if (layer === WEBPACK_LAYERS.server) {
// All packages should be bundled for the server layer if they're not opted out.
// This option takes priority over the transpilePackages option.

Expand Down
9 changes: 0 additions & 9 deletions test/e2e/app-dir/actions/app-action.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ createNextDescribe(
files: __dirname,
dependencies: {
react: 'latest',
nanoid: 'latest',
'react-dom': 'latest',
'server-only': 'latest',
},
Expand Down Expand Up @@ -282,14 +281,6 @@ createNextDescribe(
}
})
})

it('should bundle external libraries if they are on the action layer', async () => {
await next.fetch('/client')
const pageBundle = await fs.readFile(
join(next.testDir, '.next', 'server', 'app', 'client', 'page.js')
)
expect(pageBundle.toString()).toContain('node_modules/nanoid/index.js')
})
}

describe('Edge SSR', () => {
Expand Down
9 changes: 0 additions & 9 deletions test/e2e/app-dir/actions/app/client/actions-lib.js

This file was deleted.

4 changes: 0 additions & 4 deletions test/e2e/app-dir/actions/app/client/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import { useState } from 'react'

import double, { inc, dec, redirectAction, getHeaders } from './actions'
import { test } from './actions-lib'

export default function Counter() {
const [count, setCount] = useState(0)
Expand Down Expand Up @@ -59,9 +58,6 @@ export default function Counter() {
submit
</button>
</form>
<form action={test}>
<button>test</button>
</form>
</div>
)
}

0 comments on commit 9f810e1

Please sign in to comment.