nuxt-bun-compile 0.1.17 → 0.1.19
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 +18 -97
- package/README.ptBR.md +53 -132
- package/dist/module.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,27 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
>
|
|
15
|
-
> The following commands **DO NOT** trigger binary compilation:
|
|
16
|
-
> ```bash
|
|
17
|
-
> bun run build # ❌ does not generate the binary
|
|
18
|
-
> npm run build # ❌ does not generate the binary
|
|
19
|
-
> pnpm run build # ❌ does not generate the binary
|
|
20
|
-
> ```
|
|
21
|
-
>
|
|
22
|
-
> The correct command is:
|
|
23
|
-
> ```bash
|
|
24
|
-
> bun run -b build # ✅ generates the binary (nuxtbin or the name set in outfile)
|
|
25
|
-
> ```
|
|
26
|
-
>
|
|
27
|
-
> [Why is `-b` required?](https://github.com/jprando/nuxt-bun-compile?tab=readme-ov-file#why-is--b-required)
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
## 🚀 Super Flash Start
|
|
32
|
-
|
|
33
|
-
Add the module to any Nuxt project in two steps:
|
|
13
|
+
## ⚡ Quick Start
|
|
34
14
|
|
|
35
15
|
**Step 1: Install the module**
|
|
36
16
|
|
|
@@ -44,56 +24,23 @@ bun nuxt add nuxt-bun-compile
|
|
|
44
24
|
bun run -b build
|
|
45
25
|
```
|
|
46
26
|
|
|
47
|
-
|
|
27
|
+
[Why is `-b` required?](https://github.com/jprando/nuxt-bun-compile?tab=readme-ov-file#why-is--b-required)
|
|
48
28
|
|
|
49
|
-
|
|
29
|
+
[If you encounter memory issues during build](https://github.com/jprando/nuxt-bun-compile?tab=readme-ov-file#why-node_options--max-old-space-size8192)
|
|
50
30
|
|
|
51
|
-
|
|
31
|
+
**Step 3: Run your binary**
|
|
52
32
|
|
|
53
33
|
```bash
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
# Or install directly from GitHub
|
|
58
|
-
bun add -D github:jprando/nuxt-bun-compile
|
|
59
|
-
|
|
60
|
-
# Or link locally for development
|
|
61
|
-
git clone https://github.com/jprando/nuxt-bun-compile.git
|
|
62
|
-
cd nuxt-bun-compile && bun install && bun link
|
|
63
|
-
cd your-nuxt-app && bun link nuxt-bun-compile && bun nuxt add nuxt-bun-compile
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
Add to your `nuxt.config.ts`:
|
|
67
|
-
|
|
68
|
-
```ts
|
|
69
|
-
export default defineNuxtConfig({
|
|
70
|
-
modules: ["nuxt-bun-compile"],
|
|
71
|
-
bunCompile: {
|
|
72
|
-
outfile: "myapp",
|
|
73
|
-
},
|
|
74
|
-
})
|
|
34
|
+
./nuxtbin
|
|
35
|
+
# Listening on http://localhost:3000
|
|
75
36
|
```
|
|
76
37
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
NODE_OPTIONS="--max-old-space-size=8192" bun run -b build
|
|
81
|
-
./myapp
|
|
82
|
-
```
|
|
38
|
+
Done! Your standalone binary is ready.
|
|
83
39
|
|
|
84
40
|
That's it. One binary. No `node_modules`. No runtime. Just your app.
|
|
85
41
|
|
|
86
42
|
---
|
|
87
43
|
|
|
88
|
-
## 🌟 Example
|
|
89
|
-
|
|
90
|
-
Check out a real project using this module:
|
|
91
|
-
|
|
92
|
-
- **Repository:** [nuxt-duckdb-wasm](https://github.com/jprando/nuxt-duckdb-wasm)
|
|
93
|
-
- **Demo:** [https://nuxt-duckdb-wasm.jeudi.workers.dev/](https://nuxt-duckdb-wasm.jeudi.workers.dev/)
|
|
94
|
-
|
|
95
|
-
---
|
|
96
|
-
|
|
97
44
|
## 🎯 What It Does
|
|
98
45
|
|
|
99
46
|
The module hooks into Nuxt's build pipeline and handles **everything** automatically:
|
|
@@ -153,14 +100,6 @@ bunCompile: {
|
|
|
153
100
|
|
|
154
101
|
## 🏗️ Architecture
|
|
155
102
|
|
|
156
|
-
```
|
|
157
|
-
src/
|
|
158
|
-
module.ts # Main module — configures Nitro + auto-compiles
|
|
159
|
-
package.json
|
|
160
|
-
tsconfig.json
|
|
161
|
-
dprint.json # Code formatter config
|
|
162
|
-
```
|
|
163
|
-
|
|
164
103
|
The module uses a **hook-based architecture**:
|
|
165
104
|
|
|
166
105
|
- **`nitro:config`** — Adjusts Nitro settings (preset, externals, bundling)
|
|
@@ -200,7 +139,7 @@ The **`-b`** (or `--bun`) flag forces Bun to be the runtime that executes the sc
|
|
|
200
139
|
|---|---|---|
|
|
201
140
|
| 🔤 | **TypeScript** | ESNext target, strict mode, bundler resolution |
|
|
202
141
|
| 🐰 | **Bun** | Runtime 1.3.9+, package manager |
|
|
203
|
-
| 💚 | **Nuxt** |
|
|
142
|
+
| 💚 | **Nuxt** | 4.x |
|
|
204
143
|
| 📐 | **dprint** | Code formatter (TS, JSON, MD, TOML, YAML, and more) |
|
|
205
144
|
| 📦 | **ESM** | Pure ES modules (`"type": "module"`) |
|
|
206
145
|
|
|
@@ -208,43 +147,25 @@ The **`-b`** (or `--bun`) flag forces Bun to be the runtime that executes the sc
|
|
|
208
147
|
|
|
209
148
|
## 🧑💻 Development
|
|
210
149
|
|
|
211
|
-
### Commands
|
|
212
|
-
|
|
213
|
-
```bash
|
|
214
|
-
# Install dependencies
|
|
215
|
-
bun install
|
|
216
|
-
|
|
217
|
-
# Format code
|
|
218
|
-
bun run format
|
|
219
|
-
|
|
220
|
-
# Link for local testing
|
|
221
|
-
bun link
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
### Code Style
|
|
225
|
-
|
|
226
|
-
- **Formatter:** dprint — always run `bun run format` before committing
|
|
227
|
-
- **Strings:** Double quotes
|
|
228
|
-
- **Semicolons:** Yes
|
|
229
|
-
- **Constants:** `UPPER_SNAKE_CASE` for module-level (`DEFAULT_EXTERNALS`)
|
|
230
|
-
- **Types:** `interface` for public APIs, `import type` for type-only imports
|
|
231
|
-
- **Node built-ins:** Use `node:` prefix (e.g. `node:child_process`)
|
|
232
|
-
|
|
233
150
|
### Testing Locally in a Nuxt App
|
|
234
151
|
|
|
235
152
|
```bash
|
|
236
|
-
# 1.
|
|
237
|
-
|
|
153
|
+
# 1. Clone this repo for local development
|
|
154
|
+
git clone https://github.com/jprando/nuxt-bun-compile.git
|
|
238
155
|
|
|
239
|
-
# 2.
|
|
156
|
+
# 2. Link the module
|
|
157
|
+
cd nuxt-bun-compile && bun install && bun prepack && bun link
|
|
158
|
+
|
|
159
|
+
# 3. Use it in your Nuxt app
|
|
240
160
|
cd your-nuxt-app && bun link nuxt-bun-compile
|
|
241
161
|
|
|
242
|
-
#
|
|
162
|
+
# 4. Add to nuxt.config.ts modules array
|
|
163
|
+
bun nuxt add nuxt-bun-compile
|
|
243
164
|
|
|
244
|
-
#
|
|
165
|
+
# 5. Build
|
|
245
166
|
NODE_OPTIONS="--max-old-space-size=8192" bun run -b build
|
|
246
167
|
|
|
247
|
-
#
|
|
168
|
+
# 6. Run the binary
|
|
248
169
|
./nuxtbin
|
|
249
170
|
```
|
|
250
171
|
|
package/README.ptBR.md
CHANGED
|
@@ -4,131 +4,78 @@
|
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
7
|
-
> 🚀
|
|
7
|
+
> 🚀 Módulo Nuxt que configura automaticamente o Nitro para `bun build --compile`, gerando um **binário executável standalone** a partir da sua aplicação Nuxt — sem dependências de runtime.
|
|
8
8
|
|
|
9
9
|
[Read in English](README.md)
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
>
|
|
15
|
-
> Os comandos abaixo **NAO** acionam a compilacao do binario:
|
|
16
|
-
> ```bash
|
|
17
|
-
> bun run build # ❌ nao gera o binario
|
|
18
|
-
> npm run build # ❌ nao gera o binario
|
|
19
|
-
> pnpm run build # ❌ nao gera o binario
|
|
20
|
-
> ```
|
|
21
|
-
>
|
|
22
|
-
> O comando correto eh:
|
|
23
|
-
> ```bash
|
|
24
|
-
> bun run -b build # ✅ gera o binario (nuxtbin ou o nome definido em outfile)
|
|
25
|
-
> ```
|
|
26
|
-
>
|
|
27
|
-
> [Por que é necessário o parâmetro `-b`?](https://github.com/jprando/nuxt-bun-compile/blob/main/README.ptBR.md#por-que-o--b-eh-obrigatorio)
|
|
13
|
+
## ⚡ Início Rápido
|
|
28
14
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
## 🚀 Super Flash Start
|
|
32
|
-
|
|
33
|
-
Adicione o modulo a qualquer projeto Nuxt em dois passos:
|
|
34
|
-
|
|
35
|
-
**Passo 1: Instalar o modulo**
|
|
15
|
+
**Passo 1: Instalar o módulo**
|
|
36
16
|
|
|
37
17
|
```bash
|
|
38
18
|
bun nuxt add nuxt-bun-compile
|
|
39
19
|
```
|
|
40
20
|
|
|
41
|
-
**Passo 2:
|
|
21
|
+
**Passo 2: Compilar seu binário**
|
|
42
22
|
|
|
43
23
|
```bash
|
|
44
24
|
bun run -b build
|
|
45
25
|
```
|
|
46
26
|
|
|
47
|
-
|
|
27
|
+
[Por que é necessário o parâmetro `-b`?](https://github.com/jprando/nuxt-bun-compile?tab=readme-ov-file#por-que--b-eh-obrigatorio)
|
|
48
28
|
|
|
49
|
-
---
|
|
29
|
+
[Se você enfrentar problemas de memória durante a compilação](https://github.com/jprando/nuxt-bun-compile?tab=readme-ov-file#por-que-node_options---max-old-space-size8192)
|
|
50
30
|
|
|
51
|
-
|
|
31
|
+
**Passo 3: Executar seu binário**
|
|
52
32
|
|
|
53
33
|
```bash
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
# Instalar diretamente do GitHub
|
|
58
|
-
bun add -D github:jprando/nuxt-bun-compile
|
|
59
|
-
|
|
60
|
-
# Ou linkar localmente para desenvolvimento
|
|
61
|
-
git clone https://github.com/jprando/nuxt-bun-compile.git
|
|
62
|
-
cd nuxt-bun-compile && bun install && bun link
|
|
63
|
-
cd sua-app-nuxt && bun link nuxt-bun-compile && bun nuxt add nuxt-bun-compile
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
Adicione ao seu `nuxt.config.ts`:
|
|
67
|
-
|
|
68
|
-
```ts
|
|
69
|
-
export default defineNuxtConfig({
|
|
70
|
-
modules: ["nuxt-bun-compile"],
|
|
71
|
-
bunCompile: {
|
|
72
|
-
outfile: "myapp",
|
|
73
|
-
},
|
|
74
|
-
})
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Build e execucao:
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
NODE_OPTIONS="--max-old-space-size=8192" bun run -b build
|
|
81
|
-
./myapp
|
|
34
|
+
./nuxtbin
|
|
35
|
+
# Listening on http://localhost:3000
|
|
82
36
|
```
|
|
83
37
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
---
|
|
87
|
-
|
|
88
|
-
## 🌟 Exemplo
|
|
89
|
-
|
|
90
|
-
Veja um projeto real utilizando este modulo:
|
|
38
|
+
Pronto! Seu binário standalone está pronto.
|
|
91
39
|
|
|
92
|
-
|
|
93
|
-
- **Demo:** [https://nuxt-duckdb-wasm.jeudi.workers.dev/](https://nuxt-duckdb-wasm.jeudi.workers.dev/)
|
|
40
|
+
Só um binário. Sem `node_modules`. Sem runtime. Apenas sua aplicação.
|
|
94
41
|
|
|
95
42
|
---
|
|
96
43
|
|
|
97
|
-
## 🎯 O que
|
|
44
|
+
## 🎯 O que Faz
|
|
98
45
|
|
|
99
|
-
O
|
|
46
|
+
O módulo se conecta ao pipeline de build do Nuxt e cuida de **tudo** automaticamente:
|
|
100
47
|
|
|
101
|
-
1. **Configura o Nitro** com as
|
|
102
|
-
2. **Externaliza pacotes
|
|
103
|
-
3. **Executa `bun build --compile`**
|
|
48
|
+
1. **Configura o Nitro** com as configurações ótimas para compilação em binário
|
|
49
|
+
2. **Externaliza pacotes problemáticos** que quebram com bundling completo
|
|
50
|
+
3. **Executa `bun build --compile`** após o build para produzir um executável standalone
|
|
104
51
|
|
|
105
|
-
###
|
|
52
|
+
### Configuração do Nitro (aplicada automaticamente)
|
|
106
53
|
|
|
107
|
-
|
|
|
54
|
+
| Configuração | Valor | Motivo |
|
|
108
55
|
|---|---|---|
|
|
109
56
|
| `preset` | `"bun"` | Usar o runtime Bun como alvo |
|
|
110
57
|
| `noExternals` | `true` | Empacotar tudo no output |
|
|
111
|
-
| `inlineDynamicImports` | `true` | Achatar imports
|
|
112
|
-
| `serveStatic` | `"inline"` | Embutir assets
|
|
113
|
-
| `esbuild.options.target` | `"esnext"` | Usar as features JS mais recentes para
|
|
58
|
+
| `inlineDynamicImports` | `true` | Achatar imports dinâmicos para output em arquivo único |
|
|
59
|
+
| `serveStatic` | `"inline"` | Embutir assets estáticos no binário |
|
|
60
|
+
| `esbuild.options.target` | `"esnext"` | Usar as features JS mais recentes para máximo desempenho |
|
|
114
61
|
|
|
115
62
|
---
|
|
116
63
|
|
|
117
|
-
## ⚙️
|
|
64
|
+
## ⚙️ Opções
|
|
118
65
|
|
|
119
|
-
|
|
|
66
|
+
| Opção | Tipo | Padrão | Descrição |
|
|
120
67
|
|---|---|---|---|
|
|
121
|
-
| `enabled` | `boolean` | `true` | Habilitar/desabilitar o
|
|
122
|
-
| `outfile` | `string` | `"nuxtbin"` | Nome do arquivo
|
|
68
|
+
| `enabled` | `boolean` | `true` | Habilitar/desabilitar o módulo |
|
|
69
|
+
| `outfile` | `string` | `"nuxtbin"` | Nome do arquivo binário de saída |
|
|
123
70
|
| `bunPath` | `string` | `undefined` | Caminho para o executável do bun. Pode ser um diretório (ex: `/opt/bun/`) ou o caminho direto para o binário (ex: `/opt/bun/bun`). Se for um diretório, '/bun' será anexado. O padrão é 'bun' do PATH do sistema. |
|
|
124
71
|
| `extraExternals` | `(string \| RegExp)[]` | `[]` | Pacotes adicionais para marcar como external |
|
|
125
|
-
| `autoCompile` | `boolean` | `true` | Executar `bun build --compile` automaticamente
|
|
72
|
+
| `autoCompile` | `boolean` | `true` | Executar `bun build --compile` automaticamente após o build |
|
|
126
73
|
|
|
127
74
|
---
|
|
128
75
|
|
|
129
|
-
## 📦 Pacotes External
|
|
76
|
+
## 📦 Pacotes External Padrão
|
|
130
77
|
|
|
131
|
-
Estes pacotes
|
|
78
|
+
Estes pacotes são conhecidos por quebrar com `noExternals: true` e são excluídos por padrão:
|
|
132
79
|
|
|
133
80
|
| Pacote | Pattern |
|
|
134
81
|
|---|---|
|
|
@@ -147,24 +94,16 @@ bunCompile: {
|
|
|
147
94
|
}
|
|
148
95
|
```
|
|
149
96
|
|
|
150
|
-
> **⚠️ Importante:** As bibliotecas listadas em `extraExternals` (assim como as externals
|
|
97
|
+
> **⚠️ Importante:** As bibliotecas listadas em `extraExternals` (assim como as externals padrão) **não são embutidas no binário**. Para que o binário `nuxtbin` execute corretamente, essas dependências precisam estar disponíveis em uma pasta `node_modules` ao lado do binário gerado.
|
|
151
98
|
|
|
152
99
|
---
|
|
153
100
|
|
|
154
101
|
## 🏗️ Arquitetura
|
|
155
102
|
|
|
156
|
-
|
|
157
|
-
src/
|
|
158
|
-
module.ts # Modulo principal — configura o Nitro + auto-compila
|
|
159
|
-
package.json
|
|
160
|
-
tsconfig.json
|
|
161
|
-
dprint.json # Configuracao do formatador de codigo
|
|
162
|
-
```
|
|
103
|
+
O módulo usa uma **arquitetura baseada em hooks**:
|
|
163
104
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
- **`nitro:config`** — Ajusta configuracoes do Nitro (preset, externals, bundling)
|
|
167
|
-
- **`nitro:compiled`** — Aciona `bun build --compile` apos o Nitro terminar o build do servidor
|
|
105
|
+
- **`nitro:config`** — Ajusta configurações do Nitro (preset, externals, bundling)
|
|
106
|
+
- **`nitro:compiled`** — Aciona `bun build --compile` após o Nitro terminar o build do servidor
|
|
168
107
|
|
|
169
108
|
### Como Funciona
|
|
170
109
|
|
|
@@ -177,12 +116,12 @@ bun run -b build
|
|
|
177
116
|
│
|
|
178
117
|
└─ hook nitro compiled ──▶ bun build .output/server/index.mjs --compile --outfile <nome>
|
|
179
118
|
│
|
|
180
|
-
└──▶ 🎉
|
|
119
|
+
└──▶ 🎉 Binário standalone pronto!
|
|
181
120
|
```
|
|
182
121
|
|
|
183
|
-
### Por que
|
|
122
|
+
### Por que `-b` é obrigatório?
|
|
184
123
|
|
|
185
|
-
Quando
|
|
124
|
+
Quando você executa `bun run build` (sem `-b`), o Bun age como um **gerenciador de tarefas** e pode delegar a execução do script ao Node.js. Nesse cenário, as variáveis `globalThis.Bun` e `process.versions.bun` **não existem**, e o módulo não consegue detectar o runtime Bun:
|
|
186
125
|
|
|
187
126
|
```ts
|
|
188
127
|
const isBun = typeof globalThis.Bun !== "undefined"
|
|
@@ -190,7 +129,7 @@ const isBun = typeof globalThis.Bun !== "undefined"
|
|
|
190
129
|
```
|
|
191
130
|
[src/module.ts:L70-L76](https://github.com/jprando/nuxt-bun-compile/blob/main/src/module.ts#L70-L76)
|
|
192
131
|
|
|
193
|
-
O
|
|
132
|
+
O parâmetro **`-b`** (ou `--bun`) força o Bun a ser o runtime que executa o script. Com ele, as variáveis acima ficam disponíveis e a etapa de `bun build --compile` é executada corretamente.
|
|
194
133
|
|
|
195
134
|
---
|
|
196
135
|
|
|
@@ -200,51 +139,33 @@ O parametro **`-b`** (ou `--bun`) forca o Bun a ser o runtime que executa o scri
|
|
|
200
139
|
|---|---|---|
|
|
201
140
|
| 🔤 | **TypeScript** | Target ESNext, strict mode, bundler resolution |
|
|
202
141
|
| 🐰 | **Bun** | Runtime 1.3.9+, gerenciador de pacotes |
|
|
203
|
-
| 💚 | **Nuxt** |
|
|
204
|
-
| 📐 | **dprint** | Formatador de
|
|
142
|
+
| 💚 | **Nuxt** | 4.x |
|
|
143
|
+
| 📐 | **dprint** | Formatador de código (TS, JSON, MD, TOML, YAML e mais) |
|
|
205
144
|
| 📦 | **ESM** | ES modules puro (`"type": "module"`) |
|
|
206
145
|
|
|
207
146
|
---
|
|
208
147
|
|
|
209
148
|
## 🧑💻 Desenvolvimento
|
|
210
149
|
|
|
211
|
-
###
|
|
150
|
+
### Testando Localmente em uma Aplicação Nuxt
|
|
212
151
|
|
|
213
152
|
```bash
|
|
214
|
-
#
|
|
215
|
-
bun
|
|
216
|
-
|
|
217
|
-
# Formatar codigo
|
|
218
|
-
bun run format
|
|
219
|
-
|
|
220
|
-
# Linkar para testes locais
|
|
221
|
-
bun link
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
### Estilo de Codigo
|
|
225
|
-
|
|
226
|
-
- **Formatador:** dprint — sempre execute `bun run format` antes de commitar
|
|
227
|
-
- **Strings:** Aspas duplas
|
|
228
|
-
- **Ponto e virgula:** Sim
|
|
229
|
-
- **Constantes:** `UPPER_SNAKE_CASE` para nivel de modulo (`DEFAULT_EXTERNALS`)
|
|
230
|
-
- **Tipos:** `interface` para APIs publicas, `import type` para imports somente de tipo
|
|
231
|
-
- **Built-ins do Node:** Use prefixo `node:` (ex: `node:child_process`)
|
|
232
|
-
|
|
233
|
-
### Testando Localmente em uma App Nuxt
|
|
153
|
+
# 1. Clone este repositório para desenvolvimento local
|
|
154
|
+
git clone https://github.com/jprando/nuxt-bun-compile.git
|
|
234
155
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
cd nuxt-bun-compile && bun link
|
|
156
|
+
# 2. Linke o módulo
|
|
157
|
+
cd nuxt-bun-compile && bun install && bun prepack && bun link
|
|
238
158
|
|
|
239
|
-
#
|
|
159
|
+
# 3. Use em sua aplicação Nuxt
|
|
240
160
|
cd sua-app-nuxt && bun link nuxt-bun-compile
|
|
241
161
|
|
|
242
|
-
#
|
|
162
|
+
# 4. Adicione ao array modules no nuxt.config.ts
|
|
163
|
+
bun nuxt add nuxt-bun-compile
|
|
243
164
|
|
|
244
|
-
#
|
|
165
|
+
# 5. Compile
|
|
245
166
|
NODE_OPTIONS="--max-old-space-size=8192" bun run -b build
|
|
246
167
|
|
|
247
|
-
#
|
|
168
|
+
# 6. Execute o binário
|
|
248
169
|
./nuxtbin
|
|
249
170
|
```
|
|
250
171
|
|
|
@@ -254,7 +175,7 @@ NODE_OPTIONS="--max-old-space-size=8192" bun run -b build
|
|
|
254
175
|
|
|
255
176
|
- [Bun](https://bun.sh) 1.3.9+ (para a etapa de `--compile`)
|
|
256
177
|
- Nuxt 3.x / 4.x
|
|
257
|
-
- Node 24+ (quando
|
|
178
|
+
- Node 24+ (quando não usar Bun como runtime)
|
|
258
179
|
|
|
259
180
|
---
|
|
260
181
|
|
|
@@ -262,18 +183,18 @@ NODE_OPTIONS="--max-old-space-size=8192" bun run -b build
|
|
|
262
183
|
|
|
263
184
|
### Por que `NODE_OPTIONS="--max-old-space-size=8192"`?
|
|
264
185
|
|
|
265
|
-
O processo de build do Nuxt com `noExternals: true` e `inlineDynamicImports: true` faz com que o Rollup/esbuild tente empacotar **todas** as
|
|
186
|
+
O processo de build do Nuxt com `noExternals: true` e `inlineDynamicImports: true` faz com que o Rollup/esbuild tente empacotar **todas** as dependências em um único bundle. Em projetos com muitas dependências, isso pode consumir mais memória do que o limite padrão do V8 (aproximadamente 1.5–2 GB), causando o erro:
|
|
266
187
|
|
|
267
188
|
```
|
|
268
189
|
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
|
|
269
190
|
```
|
|
270
191
|
|
|
271
|
-
A
|
|
192
|
+
A variável `NODE_OPTIONS="--max-old-space-size=8192"` aumenta o limite de memória heap do V8 para 8 GB, dando margem suficiente para que o bundling termine sem estourar a memória. O valor de `8192` (MB) é uma referência segura para a maioria dos projetos — ajuste conforme necessário para projetos maiores ou máquinas com menos RAM.
|
|
272
193
|
|
|
273
|
-
> **Nota:** Essa
|
|
194
|
+
> **Nota:** Essa variável afeta o processo do Node.js/V8 que roda o build do Nuxt, e não o binário final gerado pelo `bun build --compile`.
|
|
274
195
|
|
|
275
196
|
---
|
|
276
197
|
|
|
277
|
-
## 📄
|
|
198
|
+
## 📄 Licença
|
|
278
199
|
|
|
279
200
|
MIT
|
package/dist/module.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-bun-compile",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.19",
|
|
4
4
|
"description": "Nuxt module that automatically configures Nitro for `bun build --compile`, generating a standalone executable binary from your Nuxt app.",
|
|
5
5
|
"repository": "jprando/nuxt-bun-compile",
|
|
6
6
|
"license": "MIT",
|