Skip to content

Commit

Permalink
Merge branch 'canary' into fix-memory-lazy-load-babel-codeframe
Browse files Browse the repository at this point in the history
  • Loading branch information
styfle committed Sep 6, 2023
2 parents 6acaf50 + 30da48f commit 8cfefda
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 30 deletions.
2 changes: 1 addition & 1 deletion docs/01-getting-started/01-installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export default function Page() {
}
```

Next, add an `_app.tsx` file inside `pages/` to define the global layout. Learn more about the [custom App file](/docs/pages/building-your-application/routing/custom-app)).
Next, add an `_app.tsx` file inside `pages/` to define the global layout. Learn more about the [custom App file](/docs/pages/building-your-application/routing/custom-app).

```tsx filename="pages/_app.tsx" switcher
import type { AppProps } from 'next/app'
Expand Down
2 changes: 1 addition & 1 deletion docs/01-getting-started/02-project-structure.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ This page provides an overview of the file and folder structure of a Next.js pro
| [`.env.development`](/docs/app/building-your-application/configuring/environment-variables) | Development environment variables |
| [`.eslintrc.json`](/docs/app/building-your-application/configuring/eslint) | Configuration file for ESLint |
| `.gitignore` | Git files and folders to ignore |
| `.next-env.d.ts` | TypeScript declaration file for Next.js |
| `next-env.d.ts` | TypeScript declaration file for Next.js |
| `tsconfig.json` | Configuration file for TypeScript |
| `jsconfig.json` | Configuration file for JavaScript |
| `postcss.config.js` | Configuration file for Tailwind CSS |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ There are a couple of benefits to doing the rendering work on the client, includ

To use Client Components, you can add the React [`"use client"` directive](https://react.dev/reference/react/use-client) at the top of a file, above your imports.

`"use client` is used to declare a [boundary](/docs/app/building-your-application/rendering#network-boundary) between a Server and Client Component modules. This means that by defining a `"use client"` in a file, all other modules imported into it, including child components, are considered part of the client bundle - and will be rendered by React on the client.
`"use client"` is used to declare a [boundary](/docs/app/building-your-application/rendering#network-boundary) between a Server and Client Component modules. This means that by defining a `"use client"` in a file, all other modules imported into it, including child components, are considered part of the client bundle - and will be rendered by React on the client.

```tsx filename="app/counter.tsx" highlight={1} switcher
'use client'
Expand Down
6 changes: 3 additions & 3 deletions packages/next/src/build/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ function getOptimizedAliases(): { [pkg: string]: string } {
}

// Alias these modules to be resolved with "module" if possible.
function getModularizeImportAliases(packages: string[]) {
function getBarrelOptimizationAliases(packages: string[]) {
const aliases: { [pkg: string]: string } = {}
const mainFields = ['module', 'main']

Expand All @@ -492,7 +492,7 @@ function getModularizeImportAliases(packages: string[]) {

for (const field of mainFields) {
if (descriptionFileData.hasOwnProperty(field)) {
aliases[pkg] = path.join(
aliases[pkg + '$'] = path.join(
path.dirname(descriptionFilePath),
descriptionFileData[field]
)
Expand Down Expand Up @@ -1142,7 +1142,7 @@ export default async function getBaseWebpackConfig(
// For Node server, we need to re-alias the package imports to prefer to
// resolve to the ESM export.
...(isNodeServer
? getModularizeImportAliases(
? getBarrelOptimizationAliases(
config.experimental.optimizePackageImports || []
)
: {}),
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/server/config-shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ export const defaultConfig: NextConfig = {
output: !!process.env.NEXT_PRIVATE_STANDALONE ? 'standalone' : undefined,
modularizeImports: undefined,
experimental: {
serverMinification: false,
serverMinification: true,
serverSourceMaps: false,
caseSensitiveRoutes: false,
useDeploymentId: false,
Expand Down
9 changes: 7 additions & 2 deletions packages/next/src/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -676,14 +676,19 @@ function assignDefaults(
...userProvidedOptimizePackageImports,
'lucide-react',
'@headlessui/react',
'@fortawesome/fontawesome-svg-core',
'@fortawesome/free-solid-svg-icons',
'@headlessui-float/react',
'@heroicons/react/20/solid',
'@heroicons/react/24/solid',
'@heroicons/react/24/outline',
'@visx/visx',
'@tremor/react',
'rxjs',
'@mui/material',
'recharts',
'@material-ui/core',
'react-use',
'@material-ui/icons',
'@tabler/icons-react',
]),
]

Expand Down
1 change: 0 additions & 1 deletion test/integration/data-fetching-errors/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ describe('GS(S)P Page Errors', () => {
}, /error: oops/i)

expect(stderr).toContain('Error: Oops')
expect(stderr).toContain(`\n at getStaticProps`)
} finally {
await killApp(app)
}
Expand Down
23 changes: 3 additions & 20 deletions test/integration/externalize-next-server/test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-env jest */
import path from 'path'
import { nextBuild, readNextBuildServerPageFile } from 'next-test-utils'
import escapeStringRegexp from 'escape-string-regexp'

const appDir = path.join(__dirname, '../app')

Expand All @@ -12,25 +11,9 @@ describe('externalize next/dist/shared', () => {

it('Bundle next/dist/shared/lib/head.js but not next/dist/shared/lib/head-manager-context.js in _error', async () => {
const content = readNextBuildServerPageFile(appDir, '/_error')
expect(content).toMatch(
new RegExp(
'^' +
escapeStringRegexp(
`module.exports = require("next/dist/shared/lib/head-manager-context.js");`
) +
';?$',
'm'
)
)
expect(content).not.toMatch(
new RegExp(
'^' +
escapeStringRegexp(
`module.exports = require("next/dist/shared/lib/head.js");`
) +
';?$',
'm'
)
expect(content).toContain(
`require("next/dist/shared/lib/head-manager-context.js")`
)
expect(content).not.toContain(`require("next/dist/shared/lib/head.js")`)
})
})

0 comments on commit 8cfefda

Please sign in to comment.