Skip to content

Instantly share code, notes, and snippets.

@onury
onury / esm-package.md
Last active August 3, 2024 21:24 — forked from sindresorhus/esm-package.md
Pure ESM package

Pure ESM package

The package that linked you here is pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use 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.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Check if the package has a previous stable CommonJS version and use that until you can move to ESM.
@onury
onury / export-github-labels.js
Last active November 14, 2017 12:10 — forked from MoOx/index.js
Export github labels
// go on you labels pages
// eg https://github.com/cssnext/cssnext/labels
// paste this script in your console
// copy the output and now you can import it using https://github.com/popomore/github-labels !
var labels = [];
[].slice.call(document.querySelectorAll(".label-link"))
.forEach(function(element) {
labels.push({
name: element.textContent.trim(),
@onury
onury / import-github-labels.js
Last active November 14, 2017 22:30 — forked from Isaddo/import-github-labels.js
import github labels via console command (my personal label colors)
/*
Go on your labels page (https://github.com/user/repo/labels)
Edit the following label array
or
Use this snippet to export github labels (https://gist.github.com/MoOx/93c2853fee760f42d97f)
and replace it
Paste this script in your console
Press Enter!!