d3 global now missing in electron
See original GitHub issueFirst of all, thank you for this awesome library! I’ve learn lots of stuff under its hood and I was able to write a disk space visualization app fairly thanks to d3.
However, in the last npm updates, the d3 global is no longer defined in Electron. I currently include d3 in electron like
<script src="node_modules/d3/d3.js"></script>
I believe the change was caused by commit 1fad2e0cf7fba217eba0eadf3cae17c15090f1dd. Of course this could be Electron specific (it having both browser and node properties), and one workaround for me is to write
<script> var d3 = require('d3') </script>
Just checking if the current d3 behaviour is correct and whether you think my solution is sound.
Issue Analytics
- State:
- Created 8 years ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
D3.js not defined with Electron - Stack Overflow
I am trying to pass on Electron my AngularJS application based on D3.js. The application works perfectly when I try it with Chrmoium...
Read more >The Order of Filling 3d and 4s Orbitals - Chemistry LibreTexts
Each additional electron usually goes into a 3d orbital. ... The 4s electrons are lost first followed by one of the 3d electrons....
Read more >Electron configurations of the 3d transition metals (video)
in the video " electron configuration for d block element" while ... the " missing " electron is instead located in the outermost...
Read more >Electron app with custom protocol - Gleb Bahmutov
Create lightweight desktop application that can open custom protocol links (similar to iTunes itmss:// or Slack slack:// application links).
Read more >How to Make Your Very First Desktop App With Electron and ...
If you restart the app, now you should see a “Hello World!” showing up. The default Svelte app. Unfortunately, if we make some...
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
At last, for my use case, I added
"node-integration": false
toBrowserWindow
options, as suggested in https://github.com/electron/electron/issues/254Now
<script src="node_modules/d3/d3.js"></script>
works nice in the usual browser env and electron one.My use case is a bit different.
I have an express app: it works like a web app and an electron one.
When I start the app in electron environment, the global d3 object is not available. That is due to
typeof module === "object" && module.exports
istrue
.main.js
index.html
As workaround I need to add the following line to the
index.html
I suggest to add also
this.d3 = d3
ifwindow
is defined in module part:or changing the condition for module case to enter in the last
else
part:Does it make sense?