Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use require.resolve to detect "framework" packages (fix pnpm) (#21048)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
- Loading branch information
1 parent
57b4134
commit a1e76fb
Showing
10 changed files
with
210 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["next/babel"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "pnpm-app-multi-page", | ||
"version": "1.0.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "next dev", | ||
"build": "next build", | ||
"start": "next start" | ||
}, | ||
"dependencies": { | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2" | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
test/integration/pnpm-support/app-multi-page/pages/about.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React, { useEffect, useState } from 'react' | ||
|
||
// Include react-dom to verify that webpack's `splitChunks` works correctly, | ||
// and client-side JS still executes as expected. | ||
// See https://github.com/vercel/next.js/issues/20884 | ||
import 'react-dom' | ||
|
||
const IndexPage = () => { | ||
const [loaded, setLoaded] = useState(false) | ||
useEffect(() => { | ||
setLoaded(true) | ||
}, []) | ||
|
||
return <h1>Hello {loaded && <span id="world">World</span>}</h1> | ||
} | ||
|
||
export default IndexPage |
12 changes: 12 additions & 0 deletions
12
test/integration/pnpm-support/app-multi-page/pages/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React, { useEffect, useState } from 'react' | ||
|
||
const IndexPage = () => { | ||
const [loaded, setLoaded] = useState(false) | ||
useEffect(() => { | ||
setLoaded(true) | ||
}, []) | ||
|
||
return <h1>Hello {loaded && <span id="world">World</span>}</h1> | ||
} | ||
|
||
export default IndexPage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["next/babel"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
export default () => <h1>Hello World</h1> | ||
const IndexPage = () => <h1>Hello World</h1> | ||
|
||
export default IndexPage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters