Skip to content

Commit

Permalink
Fixup! Monkey patch.
Browse files Browse the repository at this point in the history
  • Loading branch information
sherakama committed Oct 4, 2023
1 parent ce49084 commit 41fa493
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"scripts": {
"dev": "next dev",
"build": "next build",
"prebuild": "node scripts/prebuild.js",
"start": "next start",
"lint": "next lint",
"hps": "local-ssl-proxy --cert ./dev/localhost.pem --key ./dev/localhost-key.pem",
Expand Down
23 changes: 23 additions & 0 deletions scripts/prebuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
console.log('********* PREBUILDING');
const path = require('node:path');
const fs = require('fs');
const baseDir = process.cwd();

const prebuildScripts = async () => {
const file = path.join(
baseDir,
'/node_modules',
'next/dist/server/require-hook.js',
);

const content = await fs.promises.readFile(file, 'utf-8');
await fs.promises.writeFile(
file,
content.replace(
'if (process.env.__NEXT_PRIVATE_PREBUNDLED_REACT) {',
'if (true) {',
),
);
};

prebuildScripts();

0 comments on commit 41fa493

Please sign in to comment.