next-bun-compile 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ Add the adapter to your `next.config.ts`:
|
|
|
27
27
|
import type { NextConfig } from "next";
|
|
28
28
|
|
|
29
29
|
const nextConfig: NextConfig = {
|
|
30
|
-
adapterPath:
|
|
30
|
+
adapterPath: import.meta.resolve("next-bun-compile"),
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
export default nextConfig;
|
|
@@ -39,7 +39,7 @@ export default nextConfig;
|
|
|
39
39
|
```ts
|
|
40
40
|
const nextConfig: NextConfig = {
|
|
41
41
|
experimental: {
|
|
42
|
-
adapterPath:
|
|
42
|
+
adapterPath: import.meta.resolve("next-bun-compile"),
|
|
43
43
|
},
|
|
44
44
|
};
|
|
45
45
|
```
|
|
@@ -91,7 +91,7 @@ If you configure `assetPrefix` in your `next.config.ts`, static assets (`/_next/
|
|
|
91
91
|
```ts
|
|
92
92
|
const nextConfig: NextConfig = {
|
|
93
93
|
assetPrefix: "https://cdn.example.com",
|
|
94
|
-
adapterPath:
|
|
94
|
+
adapterPath: import.meta.resolve("next-bun-compile"),
|
|
95
95
|
};
|
|
96
96
|
```
|
|
97
97
|
|
|
@@ -128,6 +128,16 @@ Some modules can't be resolved at compile time but are never reached in producti
|
|
|
128
128
|
|
|
129
129
|
## Troubleshooting
|
|
130
130
|
|
|
131
|
+
### Stale standalone output after upgrading Next.js
|
|
132
|
+
|
|
133
|
+
Next.js doesn't clean the standalone output directory between builds. If you upgrade Next.js versions, stale files from the old version can cause runtime errors like `Cannot find module 'next/dist/compiled/source-map'`.
|
|
134
|
+
|
|
135
|
+
**Fix:** Clean the standalone output before rebuilding:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
rm -rf .next/standalone && bun next build && next-bun-compile
|
|
139
|
+
```
|
|
140
|
+
|
|
131
141
|
### Packages with dynamic `require()` calls (e.g. pino)
|
|
132
142
|
|
|
133
143
|
Some packages like `pino` use dynamic `require()` calls internally (for worker threads, transports, etc.). Turbopack can't resolve these at build time, so they fail at runtime inside the compiled binary with errors like:
|
|
@@ -141,7 +151,7 @@ Failed to load external module pino-142500b1eb3f4baf: Cannot find package ...
|
|
|
141
151
|
```ts
|
|
142
152
|
const nextConfig: NextConfig = {
|
|
143
153
|
transpilePackages: ["pino", "pino-pretty"],
|
|
144
|
-
adapterPath:
|
|
154
|
+
adapterPath: import.meta.resolve("next-bun-compile"),
|
|
145
155
|
};
|
|
146
156
|
```
|
|
147
157
|
|