evanw / evanw/esbuild

URL assets bundling

Open
#795 36 comments 18 reactions 0 assignees View on GitHub
breaking
Dominant language
Go
Stars
40.1k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

Hello!

Is there any plan to support assets bundling using the URL constructor and import.meta?

Something like this:
```js
const myImg = new URL('./assets/my-img.png', import.meta.url);
```
would be equivalent to:
```js
import myImg from './assets/my-img.png';
```
but with native browser support.

This is how we can do that with rollup https://modern-web.dev/docs/building/rollup-plugin-import-meta-assets/. I think it could fit with the "convention over configuration" policy of esbuild.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.