---
title: Bun v1.0.1
description: Named imports for .json & .toml files, bugfixes to bun install, node:path, Buffer. Support for NODE_TLS_REJECT_UNAUTHORIZED=0
date: "2023-09-12T15:19:15.540Z"
author: jarred
draft: false
---

Bun v1.0.1 adds named imports for .json & .toml files, fixes a bug with `bun install` and `error.PathAlreadyExists`, fixes a bug importing node: builtins in `bun build --compile`, fixes a bug in relative() within node:path, fixes a bug where bun would load the wrong .env file, fixes a bug where tsconfig.json would be loaded in `bun run <package.json script>`, fixes a path.parse() bug, and fixes a bug where build errors would be printed twice.

Thank you for reporting issues. We are working hard to fix them as quickly as possible.

Bun is an incredibly fast JavaScript runtime, bundler, transpiler, and package manager &mdash; all in one. We've been releasing a lot of changes to Bun recently. Here's a recap of the last few releases. In case you missed it:

- [`v1.0.0`](/blog/bun-v1.0) - Bun's first stable release!

To install Bun:

{% codetabs %}

```sh#curl
$ curl -fsSL https://bun.sh/install | bash
```

```sh#npm
$ npm install -g bun
```

```sh#brew
$ brew tap oven-sh/bun
$ brew install bun
```

```sh#docker
$ docker pull oven/bun
$ docker run --rm --init --ulimit memlock=-1:-1 oven/bun
```

{% /codetabs %}

To upgrade Bun:

```sh
$ bun upgrade
```

## Named imports for .json & .toml files

When you import a .json or .toml file in Bun, you can now import the top-level keys directly.

```js
import { name, version } from "./package.json";

console.log({ name, version }); // { name: "bun", version: "1.0.1" }
```

Previously, only the default export was supported.

```js
import pkg from "./package.json";
const { name, version } = pkg;

console.log({ name, version }); // { name: "bun", version: "1.0.1" }
```

You can also import `tsconfig.json` files even if they have comments. This internally uses Bun's JSONC parser.

```js
import { paths } from "./tsconfig.json";

console.log(paths); // { "paths": { "b": ["./a.js"] } }
```

You can continue to use the default export if you prefer. The named import values are `===` to the default export's value at the same key.

```js
import boop, { array } from "./file.json";

console.log(boop.array === array); // true
```

This all works with `require` as well.

## bun install bug with `error.PathAlreadyExists`

A bug was fixed where bun install would fail with `error.PathAlreadyExists` when installing a package via hardlink.

## Bug importing node: builtins in `bun build --compile` fixed

Bun 1.0 added a regression where importing node: builtins in `bun build --compile` would fail. This has been fixed.

```js
// This failed in `bun build --compile`! It should not have.
import "node:fs/promises";
```

## Bug in relative() within node:path

Previously, the following would print `""`:

```js
console.log(path.relative("../", "../../"));
```

Now it correctly prints `..`, thanks to [@Hanaasagi](https://github.com/Hanaasagi).

## Bug where bun would load the wrong .env file

When you run `bun` in a nested `bun run` package.json script, bun would potentially load the wrong NODE_ENV variable. This has been fixed.

https://github.com/oven-sh/bun/pull/4630

## tsconfig.json no longer loaded in `bun run <package.json script>`

Previously, bun would load the tsconfig.json file in the current working directory when running a package.json script. There was no need to do this. It just wasted your time. We shouldn't do that. So we don't load tsconfig.json for package.json `"scripts"`. Note that we still load it for the runtime, just not when running a package.json script.

## Build errors printed twice bug

A bug was fixed where build errors would be printed twice.

## Bun.file() .slice offset on macOS bug

A bug was fixed where Bun.file().text(), when using .slice() to offset the buffer, would in certain cases not have seek the data to the expected position

## Buffer.from with a UTF-16 encoded hex

A bug was fixed where Buffer.from would not correctly handle hex strings from a UTF-16 encoded source.

Thanks to [@Hanaasagi](https://github.com/Hanaasagi) for fixing this.

#### Disable TLS verification using NODE_TLS_REJECT_UNAUTHORIZED

Bun now supports disabling TLS verification using NODE_TLS_REJECT_UNAUTHORIZED. This is useful for testing, but should not be used in production.

Set `NODE_TLS_REJECT_UNAUTHORIZED=0` to disable TLS verification.

```sh
$ NODE_TLS_REJECT_UNAUTHORIZED=0 bun run ./server.js
```

Thanks to [@cirospaciari](https://github.com/cirospaciari).

## path.parse() bug

The `path.parse()` function was not correctly cloning the output strings. This has been fixed, thanks to [@davidmhewitt](https://github.com/davidmhewitt).
