Closed tony19 closed 1 year ago
Hey @tony19, sorry about the radio silence. Fix coming soon :)
Any estimate when will the new version be released to the marketplace?
@TheYarin aiming for early next week.
🙏
v1.17.4 was just pushed to VS Code Marketplace, should be live within an hour or two.
Describe the bug
Preview.js cannot render basic React component in newly scaffolded Vite React TypeScript + SWC project. It works fine for the normal Vite React TypeScript template (without SWC).
Logs
Unable to render HelloWorld While Preview.js can work out of the box for simple components, you may need a custom configuration to render components that depend on: a specific state or context (see [Wrapping components](https://previewjs.com/docs/config/wrapper)) modules imported via [aliases](https://previewjs.com/docs/config/aliases) [static assets](https://previewjs.com/docs/config/static-assets) or [SVGR](https://previewjs.com/docs/config/svgr) Please see the logs below: [5:49:58 PM] Unable to parse /Users/atrinh5/src/tmp/vite-tmp/src/components/HelloWorld.tsx with Acorn: SyntaxError: Identifier 'RefreshRuntime' has already been declared (10:7) at findTopLevelEntityNames (/Users/atrinh5/.vscode/extensions/zenclabs.previewjs-1.17.3/dist/node_modules/.pnpm/@previewjs+core@15.1.2_@types+node@18.11.18/node_modules/@previewjs/core/dist/index.cjs:370:11) at TransformContext.transform (/Users/atrinh5/.vscode/extensions/zenclabs.previewjs-1.17.3/dist/node_modules/.pnpm/@previewjs+core@15.1.2_@types+node@18.11.18/node_modules/@previewjs/core/dist/index.cjs:354:35) at Object.transform (file:///Users/atrinh5/.vscode/extensions/zenclabs.previewjs-1.17.3/dist/node_modules/.pnpm/vite@4.0.4_@types+node@18.11.18/node_modules/vite/dist/node/chunks/dep-5e7f419b.js:41506:44) at async loadAndTransform (file:///Users/atrinh5/.vscode/extensions/zenclabs.previewjs-1.17.3/dist/node_modules/.pnpm/vite@4.0.4_@types+node@18.11.18/node_modules/vite/dist/node/chunks/dep-5e7f419b.js:39313:29) [5:49:58 PM] TypeError: Failed to fetch dynamically imported module: http://localhost:3141/preview/src/components/HelloWorld.tsxReproduction
npm init vite@latest
. Pick React and TypeScript + SWC.src/components/HelloWorld.tsx
with sample code:Open HelloWorld in Preview.js
(shown above component name inHelloWorld.tsx
).Preview.js version
v1.17.3
Framework
React 18.2.0
System Info
Used Package Manager
npm
Extension logs (useful for crashes)
Preview logs (useful for rendering errors)
Repo link (if available)
https://github.com/tony19-sandbox/vite-ts-react-swc
Anything else?
No response