-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
[Error 3.3.2] Components as variable = "error: __name is not defined" (TSX related) #8303
Comments
Could you provide a runnable minimal reproduction? |
@arpowers temp solution: var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, 'name', { value, configurable: true });
globalThis.__name = __name; Add this line in top of |
@xiaoxiangmoe i've downgraded vue back to 3.2.X ... did you hit the same problem? @edison1105 yes, i can put one together if this is an isolated issue... |
@xiaoxiangmoe can confirm that the temp solution did patch it @edison1105 i tried for an hour to recreate this and struck out, gonna take some time to isolate whats causing it (vite vue plugin?) |
@edison1105 @yyx990803 possible to get any suggestions on what might causing this? im struggling to duplicate in a minimal environment... will take me quite a bit of trial and error with packages, vite configs. |
I catch it. In any vue 3.3.2 project. Add file // file: run-vite.mts
import * as vite from 'vite'
const root = process.cwd()
async function main() {
const viteDevServer = await vite.createServer({
root,
logLevel: 'info',
server: {
middlewareMode: false,
hmr: {
port:6174,
},
},
appType: 'spa',
})
await viteDevServer.listen()
}
main(); Then run yarn add tsx
./node_modules/.bin/tsx ./run-vite.mts Then it throw an error:
|
@arpowers Do you use tsx or something else to run vite? |
@xiaoxiangmoe yes! Running tsx ... As a nodejs loader anyway |
So, I think it should be a bug of tsx. |
@xiaoxiangmoe good work! @edison1105 duplicated the issue here: https://github.com/arpowers/vite-example Is related to |
Probably related to our addition of |
@yyx990803 Here is a minimal reproduction for why tsx or esbuild will break demo: esbuild break @vue/compiler-sfc's depedency node_modules/source-map-js/lib/quick-sort.js |
@xiaoxiangmoe which library has the bug? |
Using source-map-js with tsx or |
@xiaoxiangmoe @arpowers |
I can also reproduce it using |
Hey @lixiaofa, have you solved this problem? I faced the same with you. |
Try this: privatenumber/tsx#113 (comment) |
Vue version
3.3.2
Steps to reproduce
This issue was introduced with latest Vue, so is a breaking change if intentional.
When importing a component into a TS file and passing to another object:
Using latest vite/vue this now creates the error:
System Info
Any additional comments?
Hoping for a quick resolution to this issue, if there is a debate about this or problem with reproduction, i will create one.
The text was updated successfully, but these errors were encountered: