mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 22:40:13 +01:00
Add support for "browser" condition (e.g., as used by Webpack) by stubbing-away Node imports (fixes #1441).
This commit is contained in:
parent
65eeb4c8d9
commit
a009407088
6 changed files with 45 additions and 32 deletions
14
lib/node-imports-node.mjs
Normal file
14
lib/node-imports-node.mjs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// @ts-check
|
||||
|
||||
import { access, accessSync, readFile, readFileSync } from "node:fs";
|
||||
export const fs = { access, accessSync, readFile, readFileSync };
|
||||
|
||||
import { createRequire } from "node:module";
|
||||
export const module = { createRequire };
|
||||
|
||||
import { EOL, homedir } from "node:os";
|
||||
export const os = { EOL, homedir };
|
||||
|
||||
// eslint-disable-next-line unicorn/import-style
|
||||
import { dirname, resolve } from "node:path";
|
||||
export const path = { dirname, resolve };
|
||||
Loading…
Add table
Add a link
Reference in a new issue