evanw / node-source-map-support

Adds source map support to node.js (for stack traces)
MIT License
2.16k stars 222 forks source link

Provide esm version #330

Open tobiasdiez opened 1 year ago

tobiasdiez commented 1 year ago

With more and more build tools (vite, nuxt, etc) going towards an esm-first build, it would be nice if a proper esm interface could be provided, i.e. transpile and distribute esm version, including correct export declaration in package.json.

jimmywarting commented 1 year ago

vote for pure ESM-only

BenceSzalai commented 10 months ago

Meanwhile could anyone show a workaround to use it with Vite/Rollup? Importing from 'source-map-support/browser-source-map-support.js' seems to be broken: TypeError: Cannot set properties of undefined (setting 'sourceMapSupport')

UPDATE: Nevermind, all I needed to do was:

import sourceMapSupport from 'source-map-support'
sourceMapSupport.install()

It works just fine with Vite.