Comments (10)
Because Electron already supports the latest JavaScript features.
from electron-reloader.
For production code yes, also for this devtool?
Sure, you cannot avoid transpiling if you are using vanilla JS, but having some ECMA stage-x features that requires Babel for Node.js to be able to run the code, or even more if TS.
Personally in development phase
- for main and preload side I switched to electromon, which is configured to consume compile products and reload on changes
- main and preload compiled products are generated by webpack, auto recompiles on source changes (watch)
- for renderer side I use webpack + wds + HMR + react-refresh (main (
BrowserWindow
) consumeshttp://...
on dev andfile://
on other tiers).
from electron-reloader.
Looking more into this, I'm not actually sure anymore why it wouldn't work when transpiled... I should have written some notes to myself about this. If it works fine for you, then great. I'll keep this open until I have time to look more into this and potentially remove that readme note.
Spent some time and it doesn't work when webpack'd because of the chokidar
dependency, which contains file-system binary that doesn't make sense to pull into a webpack'd module (and doesn't work out of the box). Basically chokidar
only makes sense when run directly by node because it's meant to watch the file system.
It works fine as far as I can tell when "transpiled" by TypeScript, although then you have to fiddle with webpack and TypeScript build tooling separately, and this increases the complexity of your whole build environment if you were relying on webpack and a TypeScript plugin loader before.
I can't think of a better fix than @feljx if you want everything to build through webpack. The module needs to be run directly by node and not packed into a webpack module.
from electron-reloader.
It works for me, so not a problem here. Thanks!
from electron-reloader.
@AidanRRR it makes sense to transpile. even if not using TS, one would use i.e. webpack to tree shake, use babel for ECMAScript stuff not available in Node (say do expressions), neatly bundle everything together.
from electron-reloader.
Ah. I think I didn't understand it correctly. So you meant like having something as Babel that writes out your Electron js files in order to support a lower ES?
But to have the Electron files written in Typescript to transpile; that is okay to do? It works with using the typescript built in transpiler.
Just making sure that I don't do something that I shouldn't! I'm sorry if I didn't get what you meant correctly.
from electron-reloader.
So you meant like having something as Babel that writes out your Electron js files in order to support a lower ES?
Yes.
But to have the Electron files written in Typescript to transpile; that is okay to do? It works with using the typescript built in transpiler.
That would be the same case.
from electron-reloader.
Looking more into this, I'm not actually sure anymore why it wouldn't work when transpiled... I should have written some notes to myself about this. If it works fine for you, then great. I'll keep this open until I have time to look more into this and potentially remove that readme note.
from electron-reloader.
@AidanRRR it makes sense to transpile. even if not using TS, one would use i.e. webpack to tree shake, use babel for ECMAScript stuff not available in Node (say do expressions), neatly bundle everything together.
For production code yes, also for this devtool?
from electron-reloader.
Looking more into this, I'm not actually sure anymore why it wouldn't work when transpiled... I should have written some notes to myself about this. If it works fine for you, then great. I'll keep this open until I have time to look more into this and potentially remove that readme note.
So I just ran into an issue where it is a problem. Custom webpack config with typescript and all the usual crazy module interop stuff that comes with it. Broke with a type error.
The workaround involves adding a tiny wrapper script in vanilla JS and requiring the transpiled app/module from within the wrapper.
#19
from electron-reloader.
Related Issues (19)
- Support Hot Module Replacement (HMR)
- Electron 7.1.7 - not working HOT 1
- When the app is reloaded the original terminal is closed HOT 7
- Delete this
- Add a note to README indicating that using electron-reloader in a static script avoids problems with transpiling main electron process HOT 1
- Apparently Window Closes when I edit Main Electron File HOT 8
- Crash Reporter continually showing up HOT 1
- Possible bug with ignore regex parsing? HOT 1
- Electron app.relaunch() fails with v15.3.0 on Windows 10 x64 HOT 3
- "Maximum call stack exceeded" with circular module references
- What is the difference between this and HMR? HOT 1
- How to solve the problem that fsevents.node in chokidar is compiled during the compilation phase of webpack production and packaging, isn't electron-reloader dynamically imported by require? HOT 1
- can not work
- no console output HOT 1
- When running in development, two windows appear HOT 3
- Add ESM support HOT 3
- Add option to force relaunch always
- Doesn't work when main entry file is in a sub-folder HOT 3
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 electron-reloader.