solidjs / solid-refresh

MIT License
86 stars 18 forks source link

ref ins rsbuild failed #66

Closed 6643 closed 3 months ago

6643 commented 7 months ago

Describe the bug

I saw this in solidjs-use. But failed in rsbuild. I don't know the reason why this report is wrong. Solidjs-use is written wrong. Or. Rsbuild was wrong. https://github.com/web-infra-dev/rsbuild/issues/1963

Your Example Website or App

https://github.com/web-infra-dev/rsbuild/issues/1963

Steps to Reproduce the Bug or Issue

https://github.com/web-infra-dev/rsbuild/issues/1963

Expected behavior

https://github.com/web-infra-dev/rsbuild/issues/1963

Screenshots or Videos

No response

Platform

Additional context

No response

chenjiahan commented 7 months ago

This might be a bug of solid-refresh v0.7.5, see https://github.com/web-infra-dev/rsbuild/issues/1963 for details.

ryansolid commented 7 months ago

@lxsmnsyc can you comment on this?

Alloyed commented 7 months ago

this happens to us too using esbuild. here's a comment + workaround from our repo:

            // the solid-js transform for refs assumes its input is mutable, ie. not const:
            // esbuild converts this for us in production builds, but it happens
            // too late in the process for unbundled builds like this one. So
            // instead we'll use babel to convert down to var scoped variables.
            ['@babel/plugin-transform-block-scoping'],
            [babelFastRefreshPlugin, cSolidRefreshOptions],
            [jsxTransform, cSolidOptions],

When I originally wrote this comment I may have blamed the base jsx transform rather than the refresh plugin, but it is true that this only happens when the refresh plugin is included!

ryansolid commented 6 months ago

Ok then lets move this to refresh.