## What?
Ensures the name of the chunk is not the same between two modules in different layers.
E.g. if you import 'button-library' in App Router and Pages Router we don't want these to be bundled in the same chunk as they're never used on the same page.
## How?
Added the layer to the chunk name hash generation in splitChunks. Ensures the two modules don't have the same chunk name generated, as discussed with @sokra.
Follow-up to #50324
Since the static metadata routes should always be static that can be
optimized, they should be marked as default runtime (or basically no
runtime). This PR change the runtime detection, if it's a static
metadata route file, its runtime will be erased.
So that it won't be picked up by `edge-app-route-loader` and then by
`next-image-loader` which emits the unexpected static file
Fixes NEXT-1238
If using Server Actions on the client layer without enabling the
`serverActions` feature, the build should error. Add a test case to
ensure #50199 works.
This change allows the Turbopack's node router to serve
`_next/static/development/_devMiddlewareManifest.json` file, which is
just the matchers for middleware routes. This is usually handled by the
node dev server anyways, but we were filtering out the route so that
Turbopack could handle it.
But, Turbopack doesn't implement the route matching logic at all, it's
all handled by our node router. So Turbopack can't know what the
middleware matchers are. Having the router just handle this like the
normal dev server is both easy and efficient (I don't want to spin up
_another_ node instance just to transform the matchers into the expected
format).
Fixes WEB-979
---------
Co-authored-by: JJ Kasper <jj@jjsweb.site>
A previous
[PR](https://github.com/vercel/next.js/pull/49110#discussion_r1183282878)
tried to reuse `rawNextConfig.experimental.outputFileTracingRoot` before
invoking Turbopack, but that will always be undefined because
`assignDefaults` hasn't been called yet. This creates a shared utility
to be reused.
Fixes next start listening as it currently behaves in-consistently
between dev and start, this shouldn't break any existing behavior as the
default is to listen on all interfaces and if it needs to be locked down
it still can be.
x-ref:
https://github.com/vercel/next.js/actions/runs/5065560220/jobs/9094296465
Since there is no longer a limitation that requires us to static analyze
`process.env`, this PR removes it from the build process and updates the
corresponding documentation.
### What?
This reverts commit 6ebc725fe6 / #50247.
### Why?
#49972 is reverted due to bugs, and I'm retrying it.
### How?
Closes WEB-1072
Closes WEB-1097
Closes NEXT-1156 (as it's reopened by the revert PR)
fix#48469
---------
Co-authored-by: Shu Ding <g@shud.in>
Follow-up to https://github.com/vercel/next.js/pull/48019 ensures we
don't use arbitrary ports by incrementing favoring always getting a
fresh free port instead. Also favors exact address for internal IPC
requests instead of `localhost`.
### What?
Implement a CJS optimizer for next-swc
### Why?
x-ref: https://vercel.slack.com/archives/C02HY34AKME/p1684341093462309
Assuming most CJS files are transpiled from ESM, we can mimic
tree-shaking using an AST transform.
### How?
Closes WEB-1072
Fixes#48469
fix NEXT-1156
---------
Co-authored-by: Shu Ding <g@shud.in>
## Bug
This fix closes#47083 issue
This fix closes#47561 issue
This fix closes#48376 issue
**Invalid repetition PRs:** #47671 (this PR changing expired code)
(This issue still exist on
[v13.4.3-canary.1](https://github.com/vercel/next.js/releases/tag/v13.4.3-canary.1)
- [x] Related issues linked using `fixes #number`
### What?
When running `NODE_OPTIONS='--inspect' next dev`,
the render server didn't start with `--inspect`.
In some cases,
the `--inspect` flag will be passed when `__NEXT_DISABLE_MEMORY_WATCHER`
was set.
### Why?
Since #47208 revamped some startup processes, the `NODE_OPTIONS`
environment parameter is not passed down to the render server worker.
### How?
Just add back the original startup process.
![image](https://user-images.githubusercontent.com/14261588/230398898-791e6909-6f4c-493b-937d-058a7b788849.png)
link NEXT-1176
---------
Co-authored-by: JJ Kasper <jj@jjsweb.site>
fixes#49783
### What?
Added the following packages to the server component exclusion list
which prevents these packages from going through the currently default
compile pipeline for apps that use the App Router. Packages added are:
"@blockfrost/blockfrost-js", "@jpg-store/lucid-cardano" and "mongoose".
(For instance, mongo was already in this exclusion list)
### Why?
These packages are required by the
"@emurgo/cardano-serialization-lib-nodejs" packages and break when not
added to this list while using the app router.
### How?
I've added these packages to the server-external-packages json file in
the Next.js package's lib directory.
### What?
* allow to apply existing pipeline
* change webpack loader key to glob for more flexibility
* add test cases
* add special error message when using the old config syntax
Old config:
```js
experimental: {
turbo: {
loaders: {
".mdx": ["mdx-loader"]
}
}
}
```
New config
``` js
experimental: {
turbo: {
rules: {
// key is a glob now
// normal syntax will treat the result as ecmascript code
"*.mdx": ["mdx-loader"],
// glob allows more advanced matching
"./images/**/*.png": {
loaders: ["image-optimize-loader"],
// result of loader will be handled in other steps
// under the same name/path (here .png)
// This will use the existing .png pipeline (static asset)
// It might also use other rules matching .png.
as: "*"
},
"*.generate-image.js": {
loaders: ["image-generation-loader"],
// It also possible to pass this under a different name
// into the pipeline. Here it will treat the result as png image
as: "*.png"
}
}
}
}
```
### Why?
More flexibility and allowing to use the builtin module handling over
non-js types.
fixes WEB-1009
### Turbopack changes
* https://github.com/vercel/turbo/pull/4955 <!-- OJ Kwon -
refactor(turbopack-ecmascript): deprecate enable_emotion, enable_styled*
-->
* https://github.com/vercel/turbo/pull/4880 <!-- Tobias Koppers -
refactor webpack loader execution -->
---------
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>