Fixes two separate issues for the Next builder:
- `pages` routes unexpectedly matching to RSC routes when prefetching from `app`. This update will attempt to match the route with the corresponding `pages` entry rather than falling back to a catch-all RSC
- Fixes https://github.com/vercel/next.js/issues/53776
- `fallback: false` returning a successful status code when underlying page as a param (e.g. `/blog/[slug]` would 200 but `/blog/non-existent` would 404)
- [slack x-ref](https://vercel.slack.com/archives/C03S8ED1DKM/p1692817762403579)
We noticed some edge function builds are failing unexpectedly due to `SyntaxError`. It's triggered by valid code in [Webpack's style-loader](16e401b17a/src/runtime/styleDomAPI.js (L35C1-L40C1)):
```
if (sourceMap && typeof btoa !== "undefined") {
css += `\n/*# sourceMappingURL=data:application/json;base64,${btoa(
unescape(encodeURIComponent(JSON.stringify(sourceMap)))
)} */`;
}
```
After minification this script looks like:
```
sourceMap&&typeof btoa!="undefined"&&(css+=`
/*# sourceMappingURL=data:application/json;base64,${btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))))} */`);
```
The key point here is `\n` is replaced with newline character (`0x0A`) and the second line starts with `/*# sourceMappingURL=`. This confuses `removeComments` API in [convert-source-map](https://github.com/thlorenz/convert-source-map/tree/master) package and it removes the second line:
```
sourceMap&&typeof btoa!="undefined"&&(css+=`
```
In this PR, we implement source map stripping based on that package's regex but add some heuristic checks to prevent false positives like above.
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.
# Releases
## vercel@31.1.1
### Patch Changes
- Updated dependencies
\[[`7c30b13cc`](7c30b13ccb)]:
- @vercel/next@3.9.2
## @vercel/next@3.9.2
### Patch Changes
- Fix pages/404 gsp + i18n case
([#10258](https://github.com/vercel/vercel/pull/10258))
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
# Releases
## vercel@31.1.0
### Minor Changes
- Add 'Environment' column to 'vc list' with new '--environment' filter
and pipe URLs to stdout
([#10239](https://github.com/vercel/vercel/pull/10239))
### Patch Changes
- Update `proxy-agent` to v6.3.0
([#10226](https://github.com/vercel/vercel/pull/10226))
- Use `getNodeBinPaths()` in `vc dev`
([#10225](https://github.com/vercel/vercel/pull/10225))
- Updated dependencies
\[[`b1c14cde0`](b1c14cde03),
[`ce4633fe4`](ce4633fe4d)]:
- @vercel/next@3.9.1
- @vercel/static-build@1.3.42
## @vercel/frameworks@1.5.0
### Minor Changes
- Add `ignorePackageJsonScript` configuration for Framework command
settings to ignore the `package.json` script.
([#10228](https://github.com/vercel/vercel/pull/10228))
Enable this mode for Storybook's `buildCommand`, since it should not
invoke the "build" script, which is most likely designated for the
frontend app build.
## @vercel/fs-detectors@4.1.1
### Patch Changes
- Updated dependencies
\[[`ce4633fe4`](ce4633fe4d)]:
- @vercel/frameworks@1.5.0
## @vercel/next@3.9.1
### Patch Changes
- Fix pages and app router i18n handling
([#10243](https://github.com/vercel/vercel/pull/10243))
## @vercel/static-build@1.3.42
### Patch Changes
- Add `ignorePackageJsonScript` configuration for Framework command
settings to ignore the `package.json` script.
([#10228](https://github.com/vercel/vercel/pull/10228))
Enable this mode for Storybook's `buildCommand`, since it should not
invoke the "build" script, which is most likely designated for the
frontend app build.
Follow up PR to
8703c55f9f
which reads the newly created function config manifest and patches in
the options for resource creation.
---------
Co-authored-by: Steven <steven@ceriously.com>
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.
# Releases
## @vercel/fs-detectors@4.1.0
### Minor Changes
- Add `detectFrameworks()` function
([#10195](https://github.com/vercel/vercel/pull/10195))
## @vercel/build-utils@6.8.2
### Patch Changes
- Push back `nodejs16.x` discontinue date to `2024-02-06`
([#10209](https://github.com/vercel/vercel/pull/10209))
## vercel@31.0.3
### Patch Changes
- Fix redeploy target to be undefined when null
([#10201](https://github.com/vercel/vercel/pull/10201))
- Respect forbidden API responses
([#10178](https://github.com/vercel/vercel/pull/10178))
- Update `supports-hyperlinks` to v3
([#10208](https://github.com/vercel/vercel/pull/10208))
- Updated dependencies
\[[`0750517af`](0750517af9)]:
- @vercel/build-utils@6.8.2
- @vercel/static-build@1.3.40
- @vercel/node@2.15.5
- @vercel/remix-builder@1.8.17
## @vercel/client@12.6.5
### Patch Changes
- Updated dependencies
\[[`0750517af`](0750517af9)]:
- @vercel/build-utils@6.8.2
## @vercel/gatsby-plugin-vercel-builder@1.3.13
### Patch Changes
- Updated dependencies
\[[`0750517af`](0750517af9)]:
- @vercel/build-utils@6.8.2
- @vercel/node@2.15.5
## @vercel/node@2.15.5
### Patch Changes
- Updated dependencies
\[[`0750517af`](0750517af9)]:
- @vercel/build-utils@6.8.2
## @vercel/remix-builder@1.8.17
### Patch Changes
- Updated dependencies
\[[`0750517af`](0750517af9)]:
- @vercel/build-utils@6.8.2
## @vercel/static-build@1.3.40
### Patch Changes
- Updated dependencies \[]:
- @vercel/gatsby-plugin-vercel-builder@1.3.13
## @vercel-internals/types@1.0.5
### Patch Changes
- Updated dependencies
\[[`0750517af`](0750517af9)]:
- @vercel/build-utils@6.8.2
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.
# Releases
## vercel@31.0.1
### Patch Changes
- Updated dependencies
\[[`aa734efc6`](aa734efc6c)]:
- @vercel/next@3.8.8
## @vercel/next@3.8.8
### Patch Changes
- [next] Ensure RSC paths handle basePath
([#10155](https://github.com/vercel/vercel/pull/10155))
The `getNodeBinPath()` function is problematic because it assumes that commands are installed in the `node_modules` directory alongside the detected lockfile. This works fine the majority of the time, but ends up not being the case when using a monorepo that uses a package manager in "linked" mode (i.e. pnpm by default).
Consider the following:
```
.
├── pnpm-lock.yaml
├── node_modules
├── blog
│ ├── node_modules
│ │ ├── hexo -> .pnpm/hexo@3.9.0/node_modules/hexo
```
In this setup, adding the root-level `node_modules/.bin` would not make the `hexo` command be visible in the `$PATH`.
To solve this issue, the new `getNodeBinPaths()` function returns an array of all directories up to the specified `root`, which can then be placed into the `$PATH`. It's also more efficient (synchronous) since it does not need to scan for a lockfile anymore (the `root` needs to be specified explicitly).
The new function is being used in `@vercel/next` and `@vercel/static-build`.
The `traverseUpDirectories()` function from CLI was moved to `build-utils` to implement this function. Consequently, that makes the implementations of `walkParentDirs()` and `walkParentDirsMulti()` simpler, since it's using this generator now.
Right now, we can't detect API routes correctly if `pageExtensions` is set:
> WARNING: Unable to find source file for page xxxx with extensions: js, jsx, ts, tsx, this can cause functions config from `vercel.json` to not be applied
We added appDir support in https://github.com/vercel/vercel/pull/9811 so that users can customize `memory`/`maxDuration` for routes in appDir.
But since RSC is enabled by default in Next.js 13, `vercel build` still reports some warning messages, such as:
```json
"functions": {
"app/**/*": {
"maxDuration": 5,
"memory": 512
}
}
```
```
WARNING: Unable to find source file for page hello.js with extensions: ts, tsx, js, jsx, md, mdx, this can cause functions config from `vercel.json` to not be applied
WARNING: Unable to find source file for page index.js with extensions: ts, tsx, js, jsx, md, mdx, this can cause functions config from `vercel.json` to not be applied
```
To suppress these errors and properly apply `functions` setting to those routes, updating the current detection logic to also search `page.${ext}` files.
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.
# Releases
## vercel@29.3.4
### Patch Changes
- Updated dependencies
\[[`67e556bc8`](67e556bc80),
[`ba10fb4dd`](ba10fb4dd4)]:
- @vercel/remix-builder@1.8.9
- @vercel/next@3.8.4
## @vercel/next@3.8.4
### Patch Changes
- Update handling for react prebundled flag
([#9974](https://github.com/vercel/vercel/pull/9974))
## @vercel/remix-builder@1.8.9
### Patch Changes
- Upgrade `@remix-run/dev` fork to v1.16.1
([#9971](https://github.com/vercel/vercel/pull/9971))
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This ensures we properly set the prebundled react flag conditionally for
app and pages ensuring they are kept separate when bundling.
x-ref: https://github.com/vercel/next.js/issues/49169
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.
# Releases
## vercel@29.3.3
### Patch Changes
- Updated dependencies
\[[`6c6f3ce9d`](6c6f3ce9d2)]:
- @vercel/next@3.8.3
## @vercel/next@3.8.3
### Patch Changes
- Ensure un-necessary rsc routes are not added
([#9963](https://github.com/vercel/vercel/pull/9963))
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Adds `home` and `global` as supported values for `regions` when coming
from Next.js. We'll port these to the build output API at a later time.
Related Next.js changes: https://github.com/vercel/next.js/pull/48959
---------
Co-authored-by: JJ Kasper <jj@jjsweb.site>
Currently, `functions` property (i.e., `memory` and `maxDuration`) are
not supported in appDir routes. This PR attempts to add support.
---------
Co-authored-by: Chris Barber <chris.barber@vercel.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>