linaria icon indicating copy to clipboard operation
linaria copied to clipboard

Make @linaria/atomic depend on css-tree or CSSOM rather than postcss

Open jpnelson opened this issue 3 years ago • 1 comments

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 avatar Jan 13 '22 18:01 jpnelson

@jpnelson have you managed to fix it? Im facing the same issue

Nitsan-Baleli-lmnd avatar May 18 '23 09:05 Nitsan-Baleli-lmnd