@jaffathecake fwiw i don't think "bundlers don't perform tree-shaking of individual object keys" is true for esbuild. given this package.json ``` { "name": "json-import-test", "version": "1.0.0" } ``` and this index.js ```import { version } from './package.json'; console.log(version); ``` if you run this command ``` esbuild --bundle --format=esm index.js ``` you'll get this output: ``` // package.json var version = "1.0.0"; // index.js console.log(version); ```| mastodon.social
The import attributes feature instructs the runtime about how a module should be loaded, including the behavior of module resolution, fetching, parsing, and evaluation. It's supported in import declarations, export...from declarations, and dynamic import().| developer.mozilla.org
i think the correction on tree-shaking with esbuild also applies to vite- i just tested importing the version key from package.json and only the version shows up in the compiled output https://stackblitz.com/edit/vitejs-vite-ili6kr28?file=dist%2Fassets%2Findex-U-z2L5ic.js am i misunderstanding something?| Bluesky Social