Circulars dependencies are causing infinite loop #1193
Labels
bug report 🦗
Issue is probably a bug, but it needs to be checked
bundler: rollup 🗞️
Issue is related to rollup bundler
bundler: webpack 📦
Issue is related to webpack bundler
cat: performance 🚀
Issue is related to performance
needs: complete repro 🖥️
Issue need to have complete repro provided
Environment
@linaria/babel-preset@4.3.3
,@linaria/react@4.3.3
,@linaria/webpack-loader@4.1.11
Description
The issue happens in the real project, there we will have following import path:
Webpack successfully builds such code, but once
@linaria/webpack-loader
is in place build freezes (actually it's an infinite loop).The easiest way to find out that is to go to
node_modules/@linaria/babel-preset/lib/transform-stages/1-prepare-for-eval.js
and modify it to log activemutexes
:It outputs something like that:
I created a simple repro of this in https://github.com/layershifter/linaria-circulars-issue. In my simplified case Webpack does not go into infinite loop, it just outputs nothing:
Without circulars it complies successfully:
I also tried Webpack, Rollup and esbuild without Linaria, all they pass:
$ yarn b:webpack asset main.js 690 bytes [emitted] (name: main) orphan modules 338 bytes [orphan] 4 modules ./src/index.js + 4 modules 488 bytes [not cacheable] [built] [code generated] webpack 5.75.0 compiled successfully in 57 ms
yarn b:esbuild dist/esbuild/main.js 801b ⚡ Done in 3ms
Reproducible Demo
yarn
yarn b:webpack:linaria-no-circulars
The text was updated successfully, but these errors were encountered: