linaria icon indicating copy to clipboard operation
linaria copied to clipboard

Using the "styled" tag in runtime is not supported

Open Sanshain opened this issue 1 month ago • 0 comments

Environment

  • @linaria/core version: 5.0.2
  • Bundler (+ version): [email protected]
  • Node.js version: v18
  • OS: Win64
  • Chrome: v125.x
  • run script: rollup -c --environment NODE_ENV:production

Description

I have faced with the problem by using @linaria/rollup plugin:

/// rollup.config.js
plugins:[
        linaria({
            sourceMap: true
        }),
        // ...
        babel({
            exclude: 'node_modules/**',
            babelHelpers: 'bundled',
            configFile: inDevelopment ? './.dev.babelrc' : './.babelrc'         
        }),
]

I looked for similar issues and is it: one and two. In the first one I have found out advice to use it with @linaria/babel-preset. So I did it, but in vain. Nothing has changed.

Bisides that I of cource tryed to follow this steps with @wyw-in-js/rollup. But to be honest it doesn't work at all (even for css tag). I tryed use it also with @wyw-in-js/babel-preset, but it changes nothing. (is there anyone who has it working?). So I returned to options with @linaria/core as at least partially working.

By the way, it seems the second one hasn't been solved, but for some reason closed for some reason despite the problem still is.

Reproducible Demo

Placed in react-hmr-linaria branch here. How to reproduce:

Via degit:

degit Sanshain/preact-boilerplate#ec7b2c5ff60185ff629ab3756fd67bcbcd445187   ## version with `@linaria/rollup` via degit
degit Sanshain/preact-boilerplate#5e2176ac03ff6eb6573fe5522194e822e07ff027   ## version with `wyw` via degit

or via git:

git clone https://github.com/Sanshain/preact-boilerplate.git 
git checkout ec7b2c5ff60185ff629ab3756fd67bcbcd445187   ## version with `@linaria/rollup` via degit
git checkout 5e2176ac03ff6eb6573fe5522194e822e07ff027   ## version with `wyw` via degit

then:

npm i
npm run build

And then open with live server dist/index.html file or just open the file in a browser

Sanshain avatar May 26 '24 10:05 Sanshain