Skip to content

Instantly share code, notes, and snippets.

@bodinsamuel
Created June 23, 2023 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bodinsamuel/c03cb1dc236670b470be4511436392e9 to your computer and use it in GitHub Desktop.
Save bodinsamuel/c03cb1dc236670b470be4511436392e9 to your computer and use it in GitHub Desktop.
Find all node import without an extension

To easily migrate from CommonJS to ESM. NB: this does not fix implicit 'index.js' import

Find:

import(.*)('.?.?\/((.(?!\.js))*))';

Replace:

import$1$2.js';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment