Skip to content

Instantly share code, notes, and snippets.

View wojtekmaj's full-sized avatar

Wojciech Maj wojtekmaj

View GitHub Profile
@wojtekmaj
wojtekmaj / esmOrCjs.js
Created January 28, 2025 22:39
A function to determine if a path is going to be loaded as ESM or CJS
import assert from 'node:assert';
import path from 'node:path';
async function esmOrCjs(filepath) {
const absolutePath = import.meta.resolve(filepath).replace('file://', '');
const ext = path.extname(absolutePath);
switch (ext) {
case '.mjs':
return 'esm';
@wojtekmaj
wojtekmaj / settings.json
Last active February 14, 2025 13:35
VSCode settings worth checking out
{
// Enables breadcrumbs
"breadcrumbs.enabled": true,
// Slightly improves performance if you don't usescreen reader
"editor.accessibilitySupport": "off",
// My favorite font settings
"editor.fontFamily": "'Fira Code', monospace",
"editor.fontLigatures": true,