Open felixfbecker opened 5 years ago
Does this also happen if you import lightstep-tracer/browser
? Not super familiar with Parcel.
No, but then I am using all the bundled dependencies in the browser bundle instead of letting the bundler resolve, deduplicate and tree-shake them, and giving me the power to update dependencies for security fixes like https://github.com/lightstep/lightstep-tracer-javascript/issues/136
Ahh, ok, huh. Yeah, I think this is a pretty sane request. I'm not really sure what the right way to go about doing this would be though - split the package into a browser and non-browser version (pre-minification)?
package.json supports a browser
field that is like a main
field used when bundling for browsers. But it would require a bit of restructuring of the current code base with the platform abstraction.
Currently to use in the browser you have to either load the minified bundle, which includes (and duplicates) dependencies that I may already have in my bundle, or bundle with webpack and set
PLATFORM_BROWSER
totrue
. Parcel doesn't have an option to inject these global variables or tree-shake with them, so importinglightstep-tracer
and bundling with parcel will always end up bundling both platform implementations and running the Node implementation.