-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(examples/with-wdyr): example config to support SWC (#39465)
- Loading branch information
1 parent
db9040b
commit 249f429
Showing
4 changed files
with
38 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 was deleted.
Oops, something went wrong.
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,20 @@ | ||
const path = require('path') | ||
|
||
module.exports = { | ||
webpack(config, { dev, isServer }) { | ||
if (dev && !isServer) { | ||
const originalEntry = config.entry | ||
config.entry = async () => { | ||
const wdrPath = path.resolve(__dirname, './scripts/wdyr.js') | ||
const entries = await originalEntry() | ||
|
||
if (entries['main.js'] && !entries['main.js'].includes(wdrPath)) { | ||
entries['main.js'].push(wdrPath) | ||
} | ||
return entries | ||
} | ||
} | ||
|
||
return config | ||
}, | ||
} |
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,14 +1,16 @@ | ||
{ | ||
"private": true, | ||
"scripts": { | ||
"dev": "next", | ||
"dev": "next dev", | ||
"build": "next build", | ||
"start": "next start" | ||
}, | ||
"dependencies": { | ||
"@welldone-software/why-did-you-render": "^6.0.5", | ||
"next": "latest", | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2" | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0" | ||
}, | ||
"devDependencies": { | ||
"@welldone-software/why-did-you-render": "^7.0.1" | ||
} | ||
} |