Comments (3)
Everything works fine on 2.3.2, but when I update the 2.3.3, it fails on this like:
render(() => <App />, document.getElementById("root") as HTMLElement);
The error is:
Unhandled Promise Rejection: ReferenceError: Can't find variable: React
I'm using:
"vite": "3.1.2", "solid-js": "^1.5.5",
is there anyway to solve this?
from vite-plugin-solid.
Same issue here. With the previous version I get function calls like this:
import { createComponent as _$createComponent } from "/node_modules/.vite/deps/solid-js_web.js?v=3ad66bd1";
...
return _$createComponent(GlobalStyles, {
but with 2.3.6 I get following in the same component:
// no explicit import
...
return React.createElement(GlobalStyles_default, {
so it's clear that the JSX is being processed differently.
Another thing I noticed, is that the broken code comes from /node_modules/.vite/deps/
path, but the working code comes from /node_modules/.pnpm/
.
The readme suggests playing around with bundle pre-optimization if react code is produced (https://vitejs.dev/config/dep-optimization-options.html#optimizedeps-exclude), but I've no idea how to do this in this case.
Update:
adding
optimizeDeps: {
exclude: ['library-name']
}
to vite.config.ts
solved this issue. library-name
in this case is the name of the library where the exception was originating.
from vite-plugin-solid.
Sorry didn't follow up with this but this issue should have been fixed over month ago. I think 2.3.8 onward..If anyone is still experiencing this let me know.
from vite-plugin-solid.
Related Issues (20)
- 'Error: No known conditions for "./node" specifier in "msw" package' when using MSW with Vitest HOT 3
- Upgrade compatibility with Vite 5 HOT 3
- alias normalization breaks config
- Not working with happy-dom
- 2.8.1 vite dev server : Uncaught ReferenceError: _tmpl$ is not defined HOT 6
- Interpolation syntax error causes unhelpful "Invalid raw" error
- scope.registerDeclaration(declarationPath) error with vite-plugin-solid 2.8.2 HOT 6
- peerDependencyMeta in package.json should be peerDependenciesMeta
- vite-plugin-solid v2.8.3+ causes: `TypeError: Cannot read properties of undefined (reading 'extend')`
- missing changelog / release tags HOT 1
- optimizeDeps.include will produce the React version of the jsx result HOT 1
- I updated `vite-plugin-solid` and now namespaces merged with components are no longer allowed HOT 11
- Unable to pass signal to child components HOT 5
- Breaking updating from v2.9.1 from v2.10.0 HOT 1
- Should omitNestedClosingTags be actually required? HOT 1
- HMR not work in "solid-ts" template HOT 1
- Vite does not load proper build (server) on ssr webworker build HOT 4
- feature: SWC support
- Put packge into `@solidjs` namespace
- Vitest fails with TypeError: Unknown file extension ".jsx" HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vite-plugin-solid.