Comments (7)
Yeah, it's a bit tricky. That sort of existence check is very fragile, as there are lots of solutions nowadays that blend browser/Node features like process
and require
.
Do you have any modules in particular that are breaking or acting strangely? It would be good to test against real-world use cases rather than hypotheticals.
from devtool.
The module that borked things up for me was https://github.com/mio/mio.
Perhaps https://github.com/facebook/react might be useful to check out?
from devtool.
Here's a bit of a wacky idea... could you wrap all of the app's code in an IIFE to override the window
variable like so?
(function (window) {
// app code goes here...
console.log(window) // undefined!
})()
from devtool.
Yes I was thinking the same. We are already wrapping the code in closures anyways for Node requires. It will break the odd app that does something like this, but it's fairly non standard:
// module A
global.window = 'foo';
// module B
console.log(window);
It would probably come in through a flag like --no-browser-globals
(or maybe something more concise than that!) which also removes document
and other things.
from devtool.
Also it will mean window.close()
is not possible.
from devtool.
Pushed no-browser-globals branch.
You can try it like so:
npm i Jam3/devtool#no-browser-globals -g
devtool my-file.js --no-bg
This doesn't work in the REPL/Console, though. Going to sit on it for a while and think if there is any other way to fix this.
from devtool.
Pushed to 1.6.0
from devtool.
Related Issues (20)
- Module version mismatch. Expected 50, got 51. HOT 5
- Fails on save when using mongoose 4.x with sub-documents
- Require hook for ts-node doesn't work HOT 3
- V8 flag `--expose-gc` causes whole config to silently fail
- Reload console on file change with --watch
- Windows 10: File /npm/node_modules/devtool/index.html not found HOT 1
- Add flag to disable process.exit() HOT 1
- impossible to inspect http requests
- Devtool Chrome debugger cannot find prototype closure functions
- Ignore files when using --watch HOT 5
- Devtools doesn't work with dynamic link libraries
- REPL :: On windows (10) i can't require modules from current working directory HOT 1
- Can you add docs on how to use this with jest? HOT 1
- Support more flags in devtoolrc
- install error HOT 1
- add support async/await HOT 3
- please update new electron version
- Unable to install
- devtool with expressjs, how to find script files?
- devtool/bin/spawn replacement in Node/DevTool? Looking for advice ... HOT 1
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 devtool.