Able to use with alternative toolchain (without babel) #755
Labels
bundler: rollup 🗞️
Issue is related to rollup bundler
bundler: webpack 📦
Issue is related to webpack bundler
enhancement: proposal 💬
Improvement of current behaviour that needs to be discussed
Describe the enhancement
I'd like to contribute support for the TypeScript toolchain (without babel dependencies).
I found in
@linaria/webpack4-loader
,@linaria/webpack5-loader
and@linaria/rollup
.Motivation
Let people be able to use linaria without babel.
Proposed changes (Roadmap?)
@linaria/webpack4-loader
,@linaria/webpack5-loader
and@linaria/rollup
should not depend on@linaria/babel-preset
directly.Possible solution 1: Transformers should be applied in their own loaders/plugins (e.g.
babel-loader
orts-loader
) instead of re-parsed and re-transformed in@linaria/webpack4-loader
,@linaria/webpack5-loader
and@linaria/rollup
. Linaria depends on some extra metadata to generate CSS files. That info can be added (in the transformer) as a comment in the source file (e.g.// @linaria: <metadata JSON here>
) and get collected in the loaders so the loader does not need to call thebabel.transform
directly.Possible solution 2: The transform implementation should be passed explicitly.
Pros of solution 1: No need to parse the code twice. People can configure things separately (add linaria transformer in
babel-loader
).Cons of solution 1: Need to use a hack way to store the metadata.
Pros of solution 2: No need to change the architecture too much.
Cons of solution 2: Still need to parse the code twice.
Related Issues
#197
The text was updated successfully, but these errors were encountered: