You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using this config in my main.js to make the build to work. However, I have defined a global environment variable called __DEV__ in my project, and this variable is being replaced at build time, resulting in the following error: __DEV__ is not defined.
With that in mind, we tried to define __DEV__ in the main.js as follows:
How do we know this is replacing __DEV__ ? We have a component called ModalWrapper that uses __DEV__ and if we comment out the line with the variable, the errors goes away.
Here it is the main.js file in the last commit with the issue
We also tried to use our existing pipeline with babel-plugin-dev-expression but it didn't work.
Possible solution:
Maybe if we can enforce the order that babel will run we can fix it?
The reproduction has many moving parts (babel, custom esbuild config + vite is mainly driven by storybook) and I don't think it's easy to spot anything quickly. We'll probably need a reproduction outside of storybook at least.
Btw from your PR, it's not clear which version of Vite and plugins you're using (or automatically installed by storybook?). Please make sure to provide the information.
I haven't tried to run your PR locally yet, but one thing I might try to debug the broken transform is to maybe add own transform to dump intermediate results, something like:
Hello @guidari. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with need reproduction will be closed if they have no activity within 3 days.
Describe the bug
I am using this config in my main.js to make the build to work. However, I have defined a global environment variable called
__DEV__
in my project, and this variable is being replaced at build time, resulting in the following error:__DEV__ is not defined
.With that in mind, we tried to define
__DEV__
in the main.js as follows:However, a new error appears:
How do we know this is replacing
__DEV__
? We have a component called ModalWrapper that uses__DEV__
and if we comment out the line with the variable, the errors goes away.Here it is the main.js file in the last commit with the issue
We also tried to use our existing pipeline with
babel-plugin-dev-expression
but it didn't work.Possible solution:
Maybe if we can enforce the order that babel will run we can fix it?
vite-plugin-react/packages/plugin-react/src/index.ts
Line 114 in daa5b62
Reproduction
carbon-design-system/carbon#16910
Steps to reproduce
I paste the PR I'm working on. You can check the error in the commit:
fix: added babel back
75cc693
Go to Checks to see the CI error in vrt-runner (4)
System Info
Used Package Manager
yarn
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: