Publishing module for both Node.js and browser #946
Labels
kind: support
Asking for support with something or a specific use case
solution: duplicate
This issue or pull request already exists
topic: multi-entry
Related to multi-entry support
This question might be a bit misguided so please bear with me - I have never written a JS/TS module for other people to consume.
I'm trying to publish a library that will be consumed both in a Node.js context as well as browser context. I can't seem to figure out how to do that with Tsdx. Specifically, I'm trying to write a helper library that provides a nice integration with Storybook stories (browser context) and Jest (Node.js context).
It seems like all files are compiled into one big
name-of-my-package.cjs.dev/prod.min.js
file. This does not work for me, as that file contains an import of a library which in turn uses Node.js functionality. This then causes my browser code to crash.I guess what I want to do here is to publish two versions of my library: one which exposes the browser methods, and one that exposes the Node.js methods. I want both to be part of the same package. Is this a very strange way of doing things?
Any help here is much appreciated.
The text was updated successfully, but these errors were encountered: