How to integrate this into non-browser environments?
See original GitHub issueI tried integrating this for my custom React renderer which uses a JS environment more similar to Node (e.g. uses global
rather than window
). After I aliased global
as window
, it got stumped by the lack of an addEventListener
API:
file: node_modules/@pmmmwh/react-refresh-webpack-plugin/src/runtime/errorEventHandlers.js:85:10: JS ERROR TypeError: global.addEventListener is not a function. (In 'global.addEventListener(eventType, eventHandler)', 'global.addEventListener' is undefined)
What are the browser dependencies, and can anything be done to decouple it from the browser?
Issue Analytics
- State:
- Created 3 years ago
- Comments:32 (12 by maintainers)
Top Results From Across the Web
How to Set Up an Integrated Development Environment (IDE)
IDE Tool #1: Code Editor (and Compiler). A whole bunch of online tutorials allow you to just code in the browser, which is...
Read more >How does Javascript work in a non-browser environment?
If you look inside, here browser requests the data over http and web servers deliver it. There can be other methods of requesting...
Read more >Integration URL for easy cross-browser testing - BrowserStack
Create URLs, with testing options as parameters, to instantly start a browser on BrowserStack Live. You can integrate these URLs into your application, ......
Read more >Developing with GitHub Codespaces - Visual Studio Code
You can work with these environments from Visual Studio Code or in a browser-based editor. GitHub Codespaces extension. Environments. An environment is the...
Read more >Deploy and publish Office Add-ins - Microsoft Learn
Sideloading, As part of your development process, to test your add-in running on Windows, iPad, Mac, or in a browser. (Not for production...
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
@shirakaba I think I’ve found the culprit.
react-refresh
depends on developer tools integration, which needs to be manually injected viainjectIntoDevTools
fromreact-reconciler
.react-nativescript
doesn’t do that yet, so all thescheduleReactRefresh
calls from the plugin essentially become no-ops.You’ll have to somehow add this code snippet somewhere (presumably within the
start
function?):Yes.
ErrorOverlayEntry
don’t have to export the functions, but have to wire them up to the actual error handlers.NativeScript
uses the Node.js IPC API to signal compile status. A workaround is to subscribe to thedone
event with a custom plugin.clearCompileError
, you will first need to get compile errors wired up then run it whenever a change is detected.It will be quite a bit of work because of the complexity of the build system especially when APIs are unavailable in the actual NS runtime 😢