🍫 tidbits

You can get the current timezone for a website visitor with:


Supported in all the modern browsers.


If you're using esbuild to bundle a Node module into ESM, you may run into an error that looks like this:

throw new Error('Dynamic require of "' + x2 + '" is not supported');

ESM Node modules do not have access to require. You're seeing this error either because your code is using require, or more likely, your code imports 3rd party module that uses require.

At which point you have two options:

// require_shim.js
import { createRequire } from "module";
global.require = createRequire(import.meta.url);


If you're using, and you see this error when running npx docusaurus build, make sure you have a static directory.

ValidationError: Invalid options object. Copy Plugin has been initialized using an options object that does not match the API schema. - options.patterns should be a non-empty array.

mkdir static
touch static/.empty