linaria
linaria copied to clipboard
Make @linaria/atomic depend on css-tree or CSSOM rather than postcss
Describe the enhancement
I've run into some issues using @linaria/extractor
with @linaria/atomic
, where when evaluating dependencies, it tries to evaluate @linaria/atomic
which includes calls to fs
(which we don't allow). It does this so that it can read source maps from disk.
This creates an error like:
Cannot destructure property 'existsSync' of 'require(...)' as it is null
Motivation
This would fix it by changing the dependency and refactoring to use a smaller library with no fs calls in it.
Possible implementations
I'd consider making @linaria/atomic use https://github.com/csstree/csstree, or https://www.npmjs.com/package/cssom to avoid this issue. This would also help as we only need to be able to parse and reformat the CSS to atomize it, and postcss is a large dependency.
@jpnelson have you managed to fix it? Im facing the same issue