Proposal
Summary
The window package adds unnecessary weight in browser contexts. We can conditionally import this based on if it's a node or browser env.
I'm not sure the best approach here that preserves the types of globalThis though. There are a few possible options. Right now, I'm considering having separate entry points depending on the env:
import { ... } from 'cssom-gen'; // default is the browser version
import { ... } from 'cssom-gen/node'; // sub-path for node imports
There's also conditional imports, but that's potentially messy supporting both CJS/ESM. I don't like it much.
Open to suggestions or PRs from anyone!
Proposal
Summary
The
windowpackage adds unnecessary weight in browser contexts. We can conditionally import this based on if it's a node or browser env.I'm not sure the best approach here that preserves the types of
globalThisthough. There are a few possible options. Right now, I'm considering having separate entry points depending on the env:There's also conditional imports, but that's potentially messy supporting both CJS/ESM. I don't like it much.
Open to suggestions or PRs from anyone!