lwc icon indicating copy to clipboard operation
lwc copied to clipboard

Use `node:` protocol for all builtin imports (`fs`, `path`, etc.)

Open nolanlawson opened this issue 4 months ago • 1 comments

We should use an ESLint plugin like prefer-node-protocol and ensure we're always doing this:

import fs from 'node:fs'

instead of this:

import fs from 'fs'

The node: protocol is clearer, more portable, and less likely to conflict with any accidental non-builtins (e.g. assert).

This has some mild Node compat issues, but since we probably only support Node 16+ anyway, we can probably safely do this. (Or we can do this in a major version bump and then be explicit about our supported Node version.)

nolanlawson avatar Apr 15 '24 20:04 nolanlawson

Removed up for grabs because this is a breaking change so probably requires a lot of care and thought.

nolanlawson avatar Apr 15 '24 21:04 nolanlawson