-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doesn't compile when using react-refresh-webpack-plugin
#894
Comments
react-refresh-webpack-plugin
](https://github.com/pmmmwh/react-refresh-webpack-plugin)react-refresh-webpack-plugin
I see a similar issue using Storybook: with the following config:
|
@Elindorath Going to close this issue as it's a duplicate of #679 and #1043 (preferring 1043 as this issue has some other potentially unrelated comments). #679 contains a solution to the problem. In your case you can apply this fix by moving The issue arises from react refresh thinking that @phil-lgr @okonet You may be able to fix your problems with the advice mentioned above, however if you believe your issues are caused by something else, please feel free to create a separate issue with a reproduction. |
Describe the bug
Hi there!
I'm currently developing a react app with typescript, babel and webpack. I use
react-refresh-webpack-plugin
for fast refresh and it works well except in one case:when a file in the dependency tree of a
*.css.ts
file contains a piece of code flagged as "dynamic state" executed during file evaluation.In the linked reproduction repository, I have only one
.css.ts
file (src/global.css.ts
). It imports another file (src/colors.ts
). This file exports the variableColors
which is built when evaluating the file.I did a little digging and here's what I found:
react-refresh
generate code to register what could change between two refreshes.In the repro, it add two lines at the end of the
src/colors.ts
file:__webpack_require__.$Refresh$
isundefined
when runningevalCode
on the source in theprocessVanillaFile
function, resulting in aTypeError
Unfortunately, my understanding on this stops here, but it doesn't seem right to have those lines in a source only used to generate css files.
Reproduction
https://github.com/elindorath/vanilla-extract-repro
System Info
Used Package Manager
yarn
Logs
Validations
The text was updated successfully, but these errors were encountered: