19 Matching Annotations
- Sep 2021
-
github.com github.com
-
the bug is actually in webpack, related to fs in the web target.
-
-
blog.sindresorhus.com blog.sindresorhus.com
-
You can help make Node.js and browsers more unified. For example, Node.js has util.promisify, which is commonly used. I don’t understand why such an essential method is not also available in browsers. In turn, browsers have APIs that Node.js should have. For example, fetch, Web Streams (The Node.js stream module is awful), Web Crypto (I’ve heard rumors this one is coming), Websockets, etc.
-
The main reason I love Node.js is that I don’t have to deal with the awfulness that is JS front-end tooling.
-
- Jun 2021
-
developer.mozilla.org developer.mozilla.org
-
The globalThis property provides a standard way of accessing the global this value (and hence the global object itself) across environments. Unlike similar properties such as window and self, it's guaranteed to work in window and non-window contexts. In this way, you can access the global object in a consistent manner without having to know which environment the code is being run in.
-
-
github.com github.com
-
Unlike browsers, you can access raw Set-Cookie headers manually using Headers.raw(). This is a node-fetch only API.
-
- Jan 2021
-
www.npmjs.com www.npmjs.com
-
Think first: why do you want to use it in the browser? Remember, servers must never trust browsers. You can't sanitize HTML for saving on the server anywhere else but on the server.
-
- Dec 2020
-
sapper.svelte.dev sapper.svelte.dev
-
Note that preload will run both on the server side and on the client side. It may therefore not reference any APIs only present in the browser.
-
- Nov 2020
-
stackoverflow.com stackoverflow.com
-
If you want a reference to the global object that works in any context, you can read this from a directly-called function. const global = (function() {return this})();. This evaluates to window in the browser, self in a service worker and global in nodejs.
-
emphasizing that 'this' and 'global object' are two different things not only in Node.js but in JavaScript in general
-
- Oct 2020
-
www.basefactor.com www.basefactor.com
-
Ubiquity: you can also run your validation on the server side (e.g. nodejs)
-
-
github.com github.com
-
Use a node-style require() to organize your browser code and load modules installed by npm.
-
-
github.com github.com
-
browserify is a tool for compiling node-flavored commonjs modules for the browser.
-
-
-
Think of JavaScript. In the browser you don't have direct access to the file system. In Node.js you have. Same programming language. Different APIs.
-
-
stackoverflow.com stackoverflow.com
-
Node.js code must be run by the node process, not the browser (the code must run in the server).
-
- Sep 2020
-
medium.com medium.com
-
Modules using code that doesn’t exist in browsers such as process.env.NODE_ENV and forcing you to convert or polyfill it.
-
-
rollupjs.org rollupjs.orgRollup1
-
Some modules, like events or util, are built in to Node.js. If you want to include those (for example, so that your bundle runs in the browser), you may need to include rollup-plugin-node-polyfills.
-
-
exploringjs.com exploringjs.com
-
Ways of delivering JavaScript source code
-
- Dec 2019
-
github.com github.com
-
One thing that matters is if code uses browser-specific (example: Dom) or server-specific (example: filesystem) features.
-
-
github.com github.com
-
This is a non-dom based javascript execution environment. It usually only contains the base javascript language spec libraries and objects along with modules to communicate with OS features (available through commonjs require).
-