### Version 3.2.27 ### Reproduction link [sfc.vuejs.org/](https://sfc.vuejs.org/#eyJBcHAudnVlIjoiPHNjcmlwdCBzZXR1cD5cbmltcG9ydCB7IHJlZiB9IGZyb20gJ3Z1ZSdcbmltcG9ydCB7IHRlc3QgfSBmcm9tICcuL1Rlc3QudHMnXG5jb25zdCBtc2cgPSByZWYoJ0hlbGxvIFdvcmxkIScpXG48L3NjcmlwdD5cblxuPHRlbXBsYXRlPlxuICA8aDE+e3sgbXNnIH19PC9oMT5cbiAgPGlucHV0IHYtbW9kZWw9XCJtc2dcIj5cbiAgVGVzdDoge3sgdGVzdCB9fVxuPC90ZW1wbGF0ZT4iLCJpbXBvcnQtbWFwLmpzb24iOiJ7XG4gIFwiaW1wb3J0c1wiOiB7XG4gICAgXCJ2dWVcIjogXCJodHRwczovL3NmYy52dWVqcy5vcmcvdnVlLnJ1bnRpbWUuZXNtLWJyb3dzZXIuanNcIlxuICB9XG59IiwiVGVzdC50cyI6ImV4cG9ydCBsZXQgdGVzdCA9ICRyZWYodHJ1ZSlcbiAgICAgICAgICAgICAgICAgICAgICAgICBcbi8vIFRoaXMgd29ya3M6XG4vL2xldCBfdGVzdCA9ICRyZWYodHJ1ZSlcbi8vZXhwb3J0IGxldCB0ZXN0ID0gJCQoX3Rlc3QpIn0=) ### Steps to reproduce Check out the PLayground. it fails with `$ref is not defined` The Test.ts file in the playground has instructions for a workaround, demonstrating the transform only fails when used on an `export` ### What is expected? `$ref()` is being transformed, and App.vue succeeds in importing and using the export. ### What is actually happening? `$ref()` is left in the code untransformed, leading to a ReferenceError at runtime. ### Found by a user and reported here originally: https://github.com/vuejs/rfcs/discussions/369#discussioncomment-2009933 <!-- generated by vue-issues. DO NOT REMOVE -->