ref is not defined for production build
See original GitHub issueworks fine in development mode, but in production build with npm run build, it shows ‘ref is not defined’
<template>
<div ref="divRef">test</div>
</template>
<script setup>
const divRef = ref(null);
</script>
<style scoped></style>
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:10 (2 by maintainers)
Top Results From Across the Web
ReactJs: refs is not defined (no-undef) - Stack Overflow
In the following code, I wrapped your code a function component and use React.createRef() to create a ref and assign to okanhzai.
Read more >ReferenceError is not defined errors in production but works in ...
I made my first vue3 app, it is working in development but not in production (vite build). I've managed to replicate it like...
Read more >ReferenceError: “process is not defined” - GIMTEC
In NodeJS, “process” is defined, but not in the browser. This is because NodeJS and the browser are different runtime environments.
Read more >How to Fix ReferenceError: Event is Not Defined in JavaScript
The Javascript ReferenceError is thrown when an attempt is made to reference a non-existing or out of scope variable. Not defining a ...
Read more >Angular - ReferenceError x is not defined - Web - v5 - IMG.LY
The ReferenceError: x is not defined error message will appear if you use the optimization option in the angular.json . The additional uglification...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s a simple ref usage, but also got the same error
error TS2304: Cannot find name 'ref'.
, the version is"unplugin-auto-import": "^0.5.5"
. like this plugin vary much, but got this error, is depressedPlease upgrade to the latest version and try again. If it still fails to you, please send a PR to add a failed tests under https://github.com/antfu/unplugin-auto-import/tree/main/test/fixtures. Thanks