Skip to content

Instantly share code, notes, and snippets.

View wangrongding's full-sized avatar
🦄
breakthrough!

荣顶 wangrongding

🦄
breakthrough!
View GitHub Profile
@wangrongding
wangrongding / bookmarks
Last active March 11, 2022 06:38
chrome bookmarks backup
View bookmarks
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This is an automatically generated file.
It will be read and overwritten.
DO NOT EDIT! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks</H1>
<DL><p>
<DT><H3 ADD_DATE="1620879001" LAST_MODIFIED="1646978437" PERSONAL_TOOLBAR_FOLDER="true">书签栏</H3>
<DL><p>
@sindresorhus
sindresorhus / esm-package.md
Last active December 11, 2023 03:13
Pure ESM package
View esm-package.md

Pure ESM package

The package that linked you here is now 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. Stay on the existing version of the package until you can move to ESM.
View index.html
<!DOCTYPE html>
<p id="greeting"></p>
<script type="module">
import {Runtime, Inspector, Library} from "https://unpkg.com/@observablehq/notebook-runtime?module";
import notebook from "https://api.observablehq.com/d/6c9b7fd62ca784c0.js";
// Rewrite the notebook to redefine the “subject” cell in the main module.
const override = {
id: notebook.id,
@adamreisnz
adamreisnz / package.json
Last active October 18, 2023 01:42
Simple pure npm scripts build process
View package.json
{
"name": "project-name",
"description": "Template for static sites",
"version": "1.0.0",
"homepage": "http://www.project-name.com",
"author": {
"name": "Adam Reis",
"url": "http://adam.reis.nz"
},
"license": "UNLICENSED",