bun-types 1.1.40-canary.20241218T140547 → 1.1.40-canary.20241219T140645
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/bun.d.ts +10 -1
- package/docs/bundler/index.md +138 -64
- package/docs/bundler/plugins.md +1 -1
- package/docs/bundler/vs-esbuild.md +1 -1
- package/docs/guides/install/registry-scope.md +3 -1
- package/docs/guides/test/svelte-test.md +120 -0
- package/docs/install/npmrc.md +1 -1
- package/docs/runtime/modules.md +1 -0
- package/docs/runtime/plugins.md +4 -2
- package/package.json +1 -1
package/bun.d.ts
CHANGED
|
@@ -1596,7 +1596,7 @@ declare module "bun" {
|
|
|
1596
1596
|
define?: Record<string, string>;
|
|
1597
1597
|
// origin?: string; // e.g. http://mydomain.com
|
|
1598
1598
|
loader?: { [k in string]: Loader };
|
|
1599
|
-
sourcemap?: "none" | "linked" | "inline" | "external" | "linked"; // default: "none", true -> "inline"
|
|
1599
|
+
sourcemap?: "none" | "linked" | "inline" | "external" | "linked" | boolean; // default: "none", true -> "inline"
|
|
1600
1600
|
/**
|
|
1601
1601
|
* package.json `exports` conditions used when resolving imports
|
|
1602
1602
|
*
|
|
@@ -1690,6 +1690,15 @@ declare module "bun" {
|
|
|
1690
1690
|
* Drop function calls to matching property accesses.
|
|
1691
1691
|
*/
|
|
1692
1692
|
drop?: string[];
|
|
1693
|
+
|
|
1694
|
+
/**
|
|
1695
|
+
* When set to `true`, the returned promise rejects with an AggregateError when a build failure happens.
|
|
1696
|
+
* When set to `false`, the `success` property of the returned object will be `false` when a build failure happens.
|
|
1697
|
+
*
|
|
1698
|
+
* This defaults to `false` in Bun 1.1 and will change to `true` in Bun 1.2
|
|
1699
|
+
* as most usage of `Bun.build` forgets to check for errors.
|
|
1700
|
+
*/
|
|
1701
|
+
throw?: boolean;
|
|
1693
1702
|
}
|
|
1694
1703
|
|
|
1695
1704
|
namespace Password {
|
package/docs/bundler/index.md
CHANGED
|
@@ -1259,7 +1259,7 @@ $ bun build ./index.tsx --outdir ./out --drop=console --drop=debugger --drop=any
|
|
|
1259
1259
|
|
|
1260
1260
|
### `experimentalCss`
|
|
1261
1261
|
|
|
1262
|
-
Whether to enable _experimental_ support for bundling CSS files. Defaults to `false`.
|
|
1262
|
+
Whether to enable _experimental_ support for bundling CSS files. Defaults to `false`. In 1.2, this property will be deleted, and CSS bundling will always be enabled.
|
|
1263
1263
|
|
|
1264
1264
|
This supports bundling CSS files imported from JS, as well as CSS entrypoints.
|
|
1265
1265
|
|
|
@@ -1275,6 +1275,12 @@ const result = await Bun.build({
|
|
|
1275
1275
|
|
|
1276
1276
|
{% /codetabs %}
|
|
1277
1277
|
|
|
1278
|
+
### `throw`
|
|
1279
|
+
|
|
1280
|
+
If set to `true`, `Bun.build` will throw on build failure. See the section ["Logs and Errors"](#logs-and-errors) for more details on the error message structure.
|
|
1281
|
+
|
|
1282
|
+
In 1.2, this will default to `true`, with the previous behavior as `throw: false`
|
|
1283
|
+
|
|
1278
1284
|
## Outputs
|
|
1279
1285
|
|
|
1280
1286
|
The `Bun.build` function returns a `Promise<BuildOutput>`, defined as:
|
|
@@ -1414,7 +1420,70 @@ Refer to [Bundler > Executables](https://bun.sh/docs/bundler/executables) for co
|
|
|
1414
1420
|
|
|
1415
1421
|
## Logs and errors
|
|
1416
1422
|
|
|
1417
|
-
|
|
1423
|
+
<!-- 1.2 documentation -->
|
|
1424
|
+
<!-- On failure, `Bun.build` returns a rejected promise with an `AggregateError`. This can be logged to the console for pretty printing of the error list, or programmatically read with a `try`/`catch` block.
|
|
1425
|
+
|
|
1426
|
+
```ts
|
|
1427
|
+
try {
|
|
1428
|
+
const result = await Bun.build({
|
|
1429
|
+
entrypoints: ["./index.tsx"],
|
|
1430
|
+
outdir: "./out",
|
|
1431
|
+
});
|
|
1432
|
+
} catch (e) {
|
|
1433
|
+
// TypeScript does not allow annotations on the catch clause
|
|
1434
|
+
const error = e as AggregateError;
|
|
1435
|
+
console.error("Build Failed");
|
|
1436
|
+
|
|
1437
|
+
// Example: Using the built-in formatter
|
|
1438
|
+
console.error(error);
|
|
1439
|
+
|
|
1440
|
+
// Example: Serializing the failure as a JSON string.
|
|
1441
|
+
console.error(JSON.stringify(error, null, 2));
|
|
1442
|
+
}
|
|
1443
|
+
```
|
|
1444
|
+
|
|
1445
|
+
{% callout %}
|
|
1446
|
+
|
|
1447
|
+
Most of the time, an explicit `try`/`catch` is not needed, as Bun will neatly print uncaught exceptions. It is enough to just use a top-level `await` on the `Bun.build` call.
|
|
1448
|
+
|
|
1449
|
+
{% /callout %}
|
|
1450
|
+
|
|
1451
|
+
Each item in `error.errors` is an instance of `BuildMessage` or `ResolveMessage` (subclasses of Error), containing detailed information for each error.
|
|
1452
|
+
|
|
1453
|
+
```ts
|
|
1454
|
+
class BuildMessage {
|
|
1455
|
+
name: string;
|
|
1456
|
+
position?: Position;
|
|
1457
|
+
message: string;
|
|
1458
|
+
level: "error" | "warning" | "info" | "debug" | "verbose";
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
class ResolveMessage extends BuildMessage {
|
|
1462
|
+
code: string;
|
|
1463
|
+
referrer: string;
|
|
1464
|
+
specifier: string;
|
|
1465
|
+
importKind: ImportKind;
|
|
1466
|
+
}
|
|
1467
|
+
```
|
|
1468
|
+
|
|
1469
|
+
On build success, the returned object contains a `logs` property, which contains bundler warnings and info messages.
|
|
1470
|
+
|
|
1471
|
+
```ts
|
|
1472
|
+
const result = await Bun.build({
|
|
1473
|
+
entrypoints: ["./index.tsx"],
|
|
1474
|
+
outdir: "./out",
|
|
1475
|
+
});
|
|
1476
|
+
|
|
1477
|
+
if (result.logs.length > 0) {
|
|
1478
|
+
console.warn("Build succeeded with warnings:");
|
|
1479
|
+
for (const message of result.logs) {
|
|
1480
|
+
// Bun will pretty print the message object
|
|
1481
|
+
console.warn(message);
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
``` -->
|
|
1485
|
+
|
|
1486
|
+
By default, `Bun.build` only throws if invalid options are provided. Read the `success` property to determine if the build was successful; the `logs` property will contain additional details.
|
|
1418
1487
|
|
|
1419
1488
|
```ts
|
|
1420
1489
|
const result = await Bun.build({
|
|
@@ -1457,6 +1526,27 @@ if (!result.success) {
|
|
|
1457
1526
|
}
|
|
1458
1527
|
```
|
|
1459
1528
|
|
|
1529
|
+
In Bun 1.2, throwing an aggregate error like this will become the default beahavior. You can opt-into it early using the `throw: true` option.
|
|
1530
|
+
|
|
1531
|
+
```ts
|
|
1532
|
+
try {
|
|
1533
|
+
const result = await Bun.build({
|
|
1534
|
+
entrypoints: ["./index.tsx"],
|
|
1535
|
+
outdir: "./out",
|
|
1536
|
+
});
|
|
1537
|
+
} catch (e) {
|
|
1538
|
+
// TypeScript does not allow annotations on the catch clause
|
|
1539
|
+
const error = e as AggregateError;
|
|
1540
|
+
console.error("Build Failed");
|
|
1541
|
+
|
|
1542
|
+
// Example: Using the built-in formatter
|
|
1543
|
+
console.error(error);
|
|
1544
|
+
|
|
1545
|
+
// Example: Serializing the failure as a JSON string.
|
|
1546
|
+
console.error(JSON.stringify(error, null, 2));
|
|
1547
|
+
}
|
|
1548
|
+
```
|
|
1549
|
+
|
|
1460
1550
|
## Reference
|
|
1461
1551
|
|
|
1462
1552
|
```ts
|
|
@@ -1478,39 +1568,23 @@ interface BuildConfig {
|
|
|
1478
1568
|
*
|
|
1479
1569
|
* @default "esm"
|
|
1480
1570
|
*/
|
|
1481
|
-
format?:
|
|
1482
|
-
|
|
1483
|
-
* ECMAScript Module format
|
|
1484
|
-
*/
|
|
1485
|
-
| "esm"
|
|
1486
|
-
/**
|
|
1487
|
-
* CommonJS format
|
|
1488
|
-
* **Experimental**
|
|
1489
|
-
*/
|
|
1490
|
-
| "cjs"
|
|
1491
|
-
/**
|
|
1492
|
-
* IIFE format
|
|
1493
|
-
* **Experimental**
|
|
1494
|
-
*/
|
|
1495
|
-
| "iife";
|
|
1571
|
+
format?: "esm" | "cjs" | "iife";
|
|
1496
1572
|
naming?:
|
|
1497
1573
|
| string
|
|
1498
1574
|
| {
|
|
1499
1575
|
chunk?: string;
|
|
1500
1576
|
entry?: string;
|
|
1501
1577
|
asset?: string;
|
|
1502
|
-
};
|
|
1578
|
+
};
|
|
1503
1579
|
root?: string; // project root
|
|
1504
1580
|
splitting?: boolean; // default true, enable code splitting
|
|
1505
1581
|
plugins?: BunPlugin[];
|
|
1506
|
-
// manifest?: boolean; // whether to return manifest
|
|
1507
1582
|
external?: string[];
|
|
1508
1583
|
packages?: "bundle" | "external";
|
|
1509
1584
|
publicPath?: string;
|
|
1510
1585
|
define?: Record<string, string>;
|
|
1511
|
-
// origin?: string; // e.g. http://mydomain.com
|
|
1512
1586
|
loader?: { [k in string]: Loader };
|
|
1513
|
-
sourcemap?: "none" | "linked" | "inline" | "external" | "linked"; // default: "none", true -> "inline"
|
|
1587
|
+
sourcemap?: "none" | "linked" | "inline" | "external" | "linked" | boolean; // default: "none", true -> "inline"
|
|
1514
1588
|
/**
|
|
1515
1589
|
* package.json `exports` conditions used when resolving imports
|
|
1516
1590
|
*
|
|
@@ -1519,6 +1593,18 @@ interface BuildConfig {
|
|
|
1519
1593
|
* https://nodejs.org/api/packages.html#exports
|
|
1520
1594
|
*/
|
|
1521
1595
|
conditions?: Array<string> | string;
|
|
1596
|
+
|
|
1597
|
+
/**
|
|
1598
|
+
* Controls how environment variables are handled during bundling.
|
|
1599
|
+
*
|
|
1600
|
+
* Can be one of:
|
|
1601
|
+
* - `"inline"`: Injects environment variables into the bundled output by converting `process.env.FOO`
|
|
1602
|
+
* references to string literals containing the actual environment variable values
|
|
1603
|
+
* - `"disable"`: Disables environment variable injection entirely
|
|
1604
|
+
* - A string ending in `*`: Inlines environment variables that match the given prefix.
|
|
1605
|
+
* For example, `"MY_PUBLIC_*"` will only include env vars starting with "MY_PUBLIC_"
|
|
1606
|
+
*/
|
|
1607
|
+
env?: "inline" | "disable" | `${string}*`;
|
|
1522
1608
|
minify?:
|
|
1523
1609
|
| boolean
|
|
1524
1610
|
| {
|
|
@@ -1536,20 +1622,6 @@ interface BuildConfig {
|
|
|
1536
1622
|
* Force emitting @__PURE__ annotations even if minify.whitespace is true.
|
|
1537
1623
|
*/
|
|
1538
1624
|
emitDCEAnnotations?: boolean;
|
|
1539
|
-
// treeshaking?: boolean;
|
|
1540
|
-
|
|
1541
|
-
// jsx?:
|
|
1542
|
-
// | "automatic"
|
|
1543
|
-
// | "classic"
|
|
1544
|
-
// | /* later: "preserve" */ {
|
|
1545
|
-
// runtime?: "automatic" | "classic"; // later: "preserve"
|
|
1546
|
-
// /** Only works when runtime=classic */
|
|
1547
|
-
// factory?: string; // default: "React.createElement"
|
|
1548
|
-
// /** Only works when runtime=classic */
|
|
1549
|
-
// fragment?: string; // default: "React.Fragment"
|
|
1550
|
-
// /** Only works when runtime=automatic */
|
|
1551
|
-
// importSource?: string; // default: "react"
|
|
1552
|
-
// };
|
|
1553
1625
|
|
|
1554
1626
|
/**
|
|
1555
1627
|
* Generate bytecode for the output. This can dramatically improve cold
|
|
@@ -1562,6 +1634,37 @@ interface BuildConfig {
|
|
|
1562
1634
|
* @default false
|
|
1563
1635
|
*/
|
|
1564
1636
|
bytecode?: boolean;
|
|
1637
|
+
/**
|
|
1638
|
+
* Add a banner to the bundled code such as "use client";
|
|
1639
|
+
*/
|
|
1640
|
+
banner?: string;
|
|
1641
|
+
/**
|
|
1642
|
+
* Add a footer to the bundled code such as a comment block like
|
|
1643
|
+
*
|
|
1644
|
+
* `// made with bun!`
|
|
1645
|
+
*/
|
|
1646
|
+
footer?: string;
|
|
1647
|
+
|
|
1648
|
+
/**
|
|
1649
|
+
* **Experimental**
|
|
1650
|
+
*
|
|
1651
|
+
* Enable CSS support.
|
|
1652
|
+
*/
|
|
1653
|
+
experimentalCss?: boolean;
|
|
1654
|
+
|
|
1655
|
+
/**
|
|
1656
|
+
* Drop function calls to matching property accesses.
|
|
1657
|
+
*/
|
|
1658
|
+
drop?: string[];
|
|
1659
|
+
|
|
1660
|
+
/**
|
|
1661
|
+
* When set to `true`, the returned promise rejects with an AggregateError when a build failure happens.
|
|
1662
|
+
* When set to `false`, the `success` property of the returned object will be `false` when a build failure happens.
|
|
1663
|
+
*
|
|
1664
|
+
* This defaults to `false` in Bun 1.1 and will change to `true` in Bun 1.2
|
|
1665
|
+
* as most usage of `Bun.build` forgets to check for errors.
|
|
1666
|
+
*/
|
|
1667
|
+
throw?: boolean;
|
|
1565
1668
|
}
|
|
1566
1669
|
|
|
1567
1670
|
interface BuildOutput {
|
|
@@ -1619,32 +1722,3 @@ declare class ResolveMessage {
|
|
|
1619
1722
|
toString(): string;
|
|
1620
1723
|
}
|
|
1621
1724
|
```
|
|
1622
|
-
|
|
1623
|
-
<!--
|
|
1624
|
-
interface BuildManifest {
|
|
1625
|
-
inputs: {
|
|
1626
|
-
[path: string]: {
|
|
1627
|
-
output: {
|
|
1628
|
-
path: string;
|
|
1629
|
-
};
|
|
1630
|
-
imports: {
|
|
1631
|
-
path: string;
|
|
1632
|
-
kind: ImportKind;
|
|
1633
|
-
external?: boolean;
|
|
1634
|
-
asset?: boolean; // whether the import defaulted to "file" loader
|
|
1635
|
-
}[];
|
|
1636
|
-
};
|
|
1637
|
-
};
|
|
1638
|
-
outputs: {
|
|
1639
|
-
[path: string]: {
|
|
1640
|
-
type: "chunk" | "entrypoint" | "asset";
|
|
1641
|
-
inputs: { path: string }[];
|
|
1642
|
-
imports: {
|
|
1643
|
-
path: string;
|
|
1644
|
-
kind: ImportKind;
|
|
1645
|
-
external?: boolean;
|
|
1646
|
-
}[];
|
|
1647
|
-
exports: string[];
|
|
1648
|
-
};
|
|
1649
|
-
};
|
|
1650
|
-
} -->
|
package/docs/bundler/plugins.md
CHANGED
|
@@ -695,7 +695,7 @@ In Bun's CLI, simple boolean flags like `--minify` do not accept an argument. Ot
|
|
|
695
695
|
- In Bun, `minify` can be a boolean or an object.
|
|
696
696
|
|
|
697
697
|
```ts
|
|
698
|
-
Bun.build({
|
|
698
|
+
await Bun.build({
|
|
699
699
|
entrypoints: ['./index.tsx'],
|
|
700
700
|
// enable all minification
|
|
701
701
|
minify: true
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
name: Configure a private registry for an organization scope with bun install
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Private registries can be configured using either [`.npmrc`](https://bun.sh/docs/install/npmrc) or [`bunfig.toml`](https://bun.sh/docs/runtime/bunfig#install-registry). While both are supported, we recommend using **bunfig.toml** for enhanced flexibility and Bun-specific options.
|
|
6
|
+
|
|
7
|
+
To configure a registry for a particular npm scope:
|
|
6
8
|
|
|
7
9
|
```toml#bunfig.toml
|
|
8
10
|
[install.scopes]
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "import, require, and test Svelte components with bun test"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Bun's [Plugin API](/docs/runtime/plugins) lets you add custom loaders to your project. The `test.preload` option in `bunfig.toml` lets you configure your loader to start before your tests run.
|
|
6
|
+
|
|
7
|
+
Firstly, install `@testing-library/svelte`, `svelte`, and `@happy-dom/global-registrator`.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
$ bun add @testing-library/svelte svelte@4 @happy-dom/global-registrator
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Then, save this plugin in your project.
|
|
14
|
+
|
|
15
|
+
```ts#svelte-loader.js
|
|
16
|
+
import { plugin } from "bun";
|
|
17
|
+
import { compile } from "svelte/compiler";
|
|
18
|
+
import { readFileSync } from "fs";
|
|
19
|
+
import { beforeEach, afterEach } from "bun:test";
|
|
20
|
+
import { GlobalRegistrator } from "@happy-dom/global-registrator";
|
|
21
|
+
|
|
22
|
+
beforeEach(async () => {
|
|
23
|
+
await GlobalRegistrator.register();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
afterEach(async () => {
|
|
27
|
+
await GlobalRegistrator.unregister();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
plugin({
|
|
31
|
+
name: "svelte loader",
|
|
32
|
+
setup(builder) {
|
|
33
|
+
builder.onLoad({ filter: /\.svelte(\?[^.]+)?$/ }, ({ path }) => {
|
|
34
|
+
try {
|
|
35
|
+
const source = readFileSync(
|
|
36
|
+
path.substring(
|
|
37
|
+
0,
|
|
38
|
+
path.includes("?") ? path.indexOf("?") : path.length
|
|
39
|
+
),
|
|
40
|
+
"utf-8"
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
const result = compile(source, {
|
|
44
|
+
filename: path,
|
|
45
|
+
generate: "client",
|
|
46
|
+
dev: false,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
contents: result.js.code,
|
|
51
|
+
loader: "js",
|
|
52
|
+
};
|
|
53
|
+
} catch (err) {
|
|
54
|
+
throw new Error(`Failed to compile Svelte component: ${err.message}`);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
Add this to `bunfig.toml` to tell Bun to preload the plugin, so it loads before your tests run.
|
|
65
|
+
|
|
66
|
+
```toml#bunfig.toml
|
|
67
|
+
[test]
|
|
68
|
+
# Tell Bun to load this plugin before your tests run
|
|
69
|
+
preload = ["./svelte-loader.js"]
|
|
70
|
+
|
|
71
|
+
# This also works:
|
|
72
|
+
# test.preload = ["./svelte-loader.js"]
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
Add an example `.svelte` file in your project.
|
|
78
|
+
|
|
79
|
+
```html#Counter.svelte
|
|
80
|
+
<script>
|
|
81
|
+
export let initialCount = 0;
|
|
82
|
+
let count = initialCount;
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
<button on:click={() => (count += 1)}>+1</button>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
Now you can `import` or `require` `*.svelte` files in your tests, and it will load the Svelte component as a JavaScript module.
|
|
91
|
+
|
|
92
|
+
```ts#hello-svelte.test.ts
|
|
93
|
+
import { test, expect } from "bun:test";
|
|
94
|
+
import { render, fireEvent } from "@testing-library/svelte";
|
|
95
|
+
import Counter from "./Counter.svelte";
|
|
96
|
+
|
|
97
|
+
test("Counter increments when clicked", async () => {
|
|
98
|
+
const { getByText, component } = render(Counter);
|
|
99
|
+
const button = getByText("+1");
|
|
100
|
+
|
|
101
|
+
// Initial state
|
|
102
|
+
expect(component.$$.ctx[0]).toBe(0); // initialCount is the first prop
|
|
103
|
+
|
|
104
|
+
// Click the increment button
|
|
105
|
+
await fireEvent.click(button);
|
|
106
|
+
|
|
107
|
+
// Check the new state
|
|
108
|
+
expect(component.$$.ctx[0]).toBe(1);
|
|
109
|
+
});
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
Use `bun test` to run your tests.
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
$ bun test
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
---
|
package/docs/install/npmrc.md
CHANGED
package/docs/runtime/modules.md
CHANGED
package/docs/runtime/plugins.md
CHANGED
|
@@ -307,7 +307,7 @@ await import("my-object-virtual-module"); // { baz: "quix" }
|
|
|
307
307
|
Plugins can read and write to the [build config](https://bun.sh/docs/bundler#api) with `build.config`.
|
|
308
308
|
|
|
309
309
|
```ts
|
|
310
|
-
Bun.build({
|
|
310
|
+
await Bun.build({
|
|
311
311
|
entrypoints: ["./app.ts"],
|
|
312
312
|
outdir: "./dist",
|
|
313
313
|
sourcemap: "external",
|
|
@@ -324,6 +324,7 @@ Bun.build({
|
|
|
324
324
|
},
|
|
325
325
|
},
|
|
326
326
|
],
|
|
327
|
+
throw: true,
|
|
327
328
|
});
|
|
328
329
|
```
|
|
329
330
|
|
|
@@ -332,7 +333,7 @@ Bun.build({
|
|
|
332
333
|
**NOTE**: Plugin lifcycle callbacks (`onStart()`, `onResolve()`, etc.) do not have the ability to modify the `build.config` object in the `setup()` function. If you want to mutate `build.config`, you must do so directly in the `setup()` function:
|
|
333
334
|
|
|
334
335
|
```ts
|
|
335
|
-
Bun.build({
|
|
336
|
+
await Bun.build({
|
|
336
337
|
entrypoints: ["./app.ts"],
|
|
337
338
|
outdir: "./dist",
|
|
338
339
|
sourcemap: "external",
|
|
@@ -350,6 +351,7 @@ Bun.build({
|
|
|
350
351
|
},
|
|
351
352
|
},
|
|
352
353
|
],
|
|
354
|
+
throw: true,
|
|
353
355
|
});
|
|
354
356
|
```
|
|
355
357
|
|
package/package.json
CHANGED