Skip to content

Commit 05e2ae1

Browse files
authored
Merge branch 'canary' into fix/404-cache-control
2 parents 5e7e8ce + 3c994ab commit 05e2ae1

File tree

16 files changed

+148
-35
lines changed

16 files changed

+148
-35
lines changed

.github/workflows/build_test_deploy.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
with:
5656
path: ./*
5757
key: ${{ github.sha }}
58-
- run: ./check-pre-compiled.sh
58+
- run: ./scripts/check-pre-compiled.sh
5959
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
6060

6161
testUnit:
@@ -146,7 +146,7 @@ jobs:
146146
path: ./*
147147
key: ${{ github.sha }}
148148

149-
- run: bash ./test-pnp.sh
149+
- run: bash ./scripts/test-pnp.sh
150150
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
151151

152152
testsPass:
@@ -251,7 +251,7 @@ jobs:
251251
path: ./*
252252
key: ${{ github.sha }}
253253

254-
- run: ./publish-release.sh
254+
- run: ./scripts/publish-release.sh
255255

256256
prStats:
257257
name: Release Stats
@@ -263,7 +263,7 @@ jobs:
263263
with:
264264
path: ./*
265265
key: ${{ github.sha }}
266-
- run: ./release-stats.sh
266+
- run: ./scripts/release-stats.sh
267267
- uses: ./.github/actions/next-stats-action
268268
env:
269269
PR_STATS_COMMENT_TOKEN: ${{ secrets.PR_STATS_COMMENT_TOKEN }}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"publish-canary": "lerna version prerelease --preid canary --force-publish && release --pre --skip-questions",
3535
"publish-stable": "lerna version --force-publish",
3636
"lint-staged": "lint-staged",
37+
"next-with-deps": "./scripts/next-with-deps.sh",
3738
"next": "node --trace-deprecation --enable-source-maps packages/next/dist/bin/next",
3839
"debug": "node --inspect packages/next/dist/bin/next"
3940
},

packages/next/client/index.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,14 @@ export function renderError(renderErrorProps: RenderErrorProps): Promise<any> {
462462
return pageLoader
463463
.loadPage('/_error')
464464
.then(({ page: ErrorComponent, styleSheets }) => {
465+
return lastAppProps?.Component === ErrorComponent
466+
? import('../pages/_error').then((m) => ({
467+
ErrorComponent: m.default as React.ComponentType<{}>,
468+
styleSheets: [],
469+
}))
470+
: { ErrorComponent, styleSheets }
471+
})
472+
.then(({ ErrorComponent, styleSheets }) => {
465473
// In production we do a normal render with the `ErrorComponent` as component.
466474
// If we've gotten here upon initial render, we can use the props from the server.
467475
// Otherwise, we need to call `getInitialProps` on `App` before mounting.

packages/next/taskfile-babel.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,26 @@ const path = require('path')
66
// eslint-disable-next-line import/no-extraneous-dependencies
77
const transform = require('@babel/core').transform
88

9+
const babelClientPresetEnvOptions = {
10+
modules: 'commonjs',
11+
targets: {
12+
esmodules: true,
13+
},
14+
bugfixes: true,
15+
loose: true,
16+
// This is handled by the Next.js webpack config that will run next/babel over the same code.
17+
exclude: [
18+
'transform-typeof-symbol',
19+
'transform-async-to-generator',
20+
'transform-spread',
21+
'proposal-dynamic-import',
22+
],
23+
}
24+
925
const babelClientOpts = {
1026
presets: [
1127
'@babel/preset-typescript',
12-
[
13-
'@babel/preset-env',
14-
{
15-
modules: 'commonjs',
16-
targets: {
17-
esmodules: true,
18-
},
19-
bugfixes: true,
20-
loose: true,
21-
// This is handled by the Next.js webpack config that will run next/babel over the same code.
22-
exclude: [
23-
'transform-typeof-symbol',
24-
'transform-async-to-generator',
25-
'transform-spread',
26-
],
27-
},
28-
],
28+
['@babel/preset-env', babelClientPresetEnvOptions],
2929
['@babel/preset-react', { useBuiltIns: true }],
3030
],
3131
plugins: [

check-examples.sh renamed to scripts/check-examples.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/bin/bash
22

3-
cd `dirname $0`
4-
53
for folder in examples/* ; do
64
cp -n packages/create-next-app/templates/default/gitignore $folder/.gitignore;
75
if [ -f "$folder/package.json" ]; then
File renamed without changes.

scripts/next-with-deps.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
3+
START_DIR=$PWD
4+
# gets last argument which should be the project dir
5+
for PROJECT_DIR in $@;do :;done
6+
7+
if [ -z $PROJECT_DIR ];then
8+
echo "No project directory provided, exiting..."
9+
exit 1;
10+
fi;
11+
12+
if [ ! -d $PROJECT_DIR ];then
13+
echo "Invalid project directory provided, exiting..."
14+
exit 1;
15+
fi;
16+
17+
if [ $PROJECT_DIR == $PWD ] || [ "$PROJECT_DIR" == "." ];then
18+
echo "Project directory can not be root, exiting..."
19+
exit 1;
20+
fi;
21+
22+
CONFLICTING_DEPS=("react" "react-dom" "styled-jsx" "next")
23+
24+
for dep in ${CONFLICTING_DEPS[@]};do
25+
if [ -d "$PROJECT_DIR/node_modules/$dep" ];then
26+
HAS_CONFLICTING_DEP="yup"
27+
fi;
28+
done
29+
30+
if [ ! -z $HAS_CONFLICTING_DEP ] || [ ! -d "$PROJECT_DIR/node_modules" ];then
31+
cd $PROJECT_DIR
32+
yarn install
33+
for dep in ${CONFLICTING_DEPS[@]};do
34+
rm -rf node_modules/$dep
35+
done
36+
fi
37+
38+
cd $START_DIR
39+
yarn next $@
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)