Comments (10)
Hey, thx for trying out nimview.
There is a vue example that uses webpack and babel. Maybe you can check this one, as it is probably closer to react than svelte.
Are you using windows or Linux?
When using Windows, I would recommend to try to run the code in IE11 first in httpserver / debug mode. This usually gives additional hints.
I currently have some time. If you share the code, I can help to debug.
from nimview.
Here it is https://github.com/gavr123456789/nimview-react-test
Im using linux arch.
Used this guide: https://github.com/rollup/plugins/tree/master/packages/typescript
from nimview.
@gavr123456789
Now I get it - you are compiling your React code and get this error message in your browser.
It seems that React expects to use Node.js or at least have some variables that tell React if this is production code.
I don't think that using the svelte example to mix it with react is a good start.
Using the vue sample might be better. Maybe I can add some "hello world" React sample...
from nimview.
Yesterday I spent all my free time after work on this attempt, so I'd better wait for the hello world example, also please add typescript
from nimview.
Here is some minimal sample - not using any backend functionality yet. Seems that react has issues with polyfill on windows.
Maybe it works good on linux, where you don't need to tune babel as much as on windows. No typescript added yet.
react.zip
It may take some time until I will add some proper react example. I don't like React much.
from nimview.
Got error when trying to start in debug
Required file index not found at /home/gavr/Projects/nimViewTest/src/public/index.html; cannot start UI; the UI folder needs to be relative to the binary [IOError]
I set start("public/index.html")
...
When I trying to run yarn build I got
Creating an optimized production build...
Failed to compile.
src/index.js
Line 0: Parsing error: Cannot find module '@react/babel-preset-app'
...
When I tried to install babel-preset-react-app instead of @babel/preset-react nothing changed
from nimview.
Required file index not found at /home/gavr/Projects/nimViewTest/src/public/index.html
The file doesn't exist at this location. In the .zip file, I used start("../build/index.html")
When I trying to run yarn build
No issue on my machine when I tried npm install && npm run build
from nimview.
So - I just added an example for react:
#34
Just merged it.
It doesn't contain typescript. The other examples also just use plain JS, so I wanted to keep the examples consistent. I guess it shouldn't be a big deal to add typescript support as you can just some react sample code.
You just need to modify following:
- to create inline JS code, you may need to install an inliner, for example "npm install tauri-inliner"
- for IE 11 / babel , you need to
npm install react-app-polyfill
and include it in your index.js withimport 'react-app-polyfill/ie11'
- add
"homepage": "./", "proxy": "http://localhost:8000",
to your package.lock to have relative asset directories and port 8000 npm install nimview
and addimport backend from "nimview"
whenever you want to trigger backend code from js- create an
.env
file with contentBUILD_PATH=./dist
to compile js to adist
folder instead ofbuild
from nimview.
Nice, thank you.
Also it is not possible to use node js right?
For file browser I need some fs watch, and I cant find something for nim as good as chokidar.
from nimview.
I just had a short look at chokidar and I have no idea on how to use it with nimview. You cannot use js or node for back-end code. At least not in an async way.
Maybe you find some way - but I wouldn't know where to start.
from nimview.
Related Issues (20)
- Backend not working in Webview HOT 22
- full screen mode in nim view HOT 4
- publish apk to playstore. HOT 8
- Adding event system to send async information to client
- Setting Window Icon HOT 12
- callFrontendJs on Android HOT 2
- Building in release mode does not seem to work HOT 4
- Create a bigger usefull application HOT 1
- Create some good tutorial HOT 1
- "callFrontendJs" in Webview mode doesn't update DOM HOT 1
- SIGSEGV after ~254 times calling "callFrontendJs" / "callJs" when threads enabled and using "--gc:refc" HOT 5
- How to create application icons for the taskbar and main window? HOT 2
- Compiling with "just_core" flag - Error redefinition of "compileWithWebview" const HOT 2
- Build error on react example HOT 3
- Switch rendering engine HOT 1
- [SupportRequest] Angular usage impossible as app-component does not get loaded, but only in webview (?) HOT 3
- Unicode support in release mode HOT 2
- How do you compile, debug-run & deploy on android? HOT 4
- Feature request: run "nimview.start()" with the first parameter as a string of html, rather than a file path
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 nimview.