After compiling fresh does not run: ReferenceError: React is not defined after compilation
See original GitHub issueCreate a new app
deno run -A -r https://fresh.deno.dev newapp
then
deno compile --import-map=import_map.json -o newapp -A main.ts
Result (when you try to load the page)
An error occured during route handling or page rendering.
ReferenceError: React is not defined
at Object.Home (/denoapp/compapp/routes/index.tsx:3:5)
at https://esm.sh/v95/preact-render-to-string@5.2.4/X-ZS8q/deno/preact-render-to-string.js:12:1626
at E (https://esm.sh/v95/preact-render-to-string@5.2.4/X-ZS8q/deno/preact-render-to-string.js:12:1653)
at E (https://esm.sh/v95/preact-render-to-string@5.2.4/X-ZS8q/deno/preact-render-to-string.js:12:1729)
at E (https://esm.sh/v95/preact-render-to-string@5.2.4/X-ZS8q/deno/preact-render-to-string.js:12:1729)
at E (https://esm.sh/v95/preact-render-to-string@5.2.4/X-ZS8q/deno/preact-render-to-string.js:12:1729)
at E (https://esm.sh/v95/preact-render-to-string@5.2.4/X-ZS8q/deno/preact-render-to-string.js:12:1729)
at q (https://esm.sh/v95/preact-render-to-string@5.2.4/X-ZS8q/deno/preact-render-to-string.js:12:316)
at realRender (https://deno.land/x/fresh@1.1.1/src/server/render.ts:109:20)
at Object.render (https://deno.land/x/fresh@1.1.1/src/server/render.ts:128:13)
Issue Analytics
- State:
- Created a year ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Uncaught ReferenceError: React is not defined - Stack Overflow
Possible reasons are 1. you didn't load React.JS into your page, 2. you loaded it after the above script into your page.
Read more >"Uncaught ReferenceError: moment is not defined" using NPM
I installed Moment.js using npm: npm install moment. I'd now like to compile it using npm run dev to replace a version I...
Read more >Uncaught ReferenceError: bsCustomFileInput is not defined, M
js file and got error during compile. Frankly I doubt this will work at all. Changing bootstrap.js is just such an uncommon solution......
Read more >uncaught referenceerror: global is not defined react - You.com
The solution is to either remove this piece of configuration (so React will be bundled with your javascript) or load the React framework...
Read more >jsconfig.json Reference - Visual Studio Code
Tip: Do not be confused by compilerOptions , since no actual compilation is required for JavaScript. This attribute exists because jsconfig.json is a...
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
Yes, you can not currently use
deno compile
with fresh applications.I hope it works soon, or maybe we could have a workaround