callstack / callstack/linaria

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

Open
#901 1 comment 0 reactions 0 assignees View on GitHub
enhancement: proposal 💬 needs: triage 🏷
Dominant language
TypeScript
Stars
12.4k
Forks
413
PR merge metrics
No merged PRs in 30d

Description

## 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.