dynamicImport.mjs 377 B

12345678910111213
  1. import { isAbsolute } from 'node:path';
  2. import { pathToFileURL } from 'node:url';
  3. /**
  4. * Dynamic import wrapper for compatibility with absolute paths on Windows
  5. *
  6. * @see https://github.com/stylelint/stylelint/issues/7382
  7. *
  8. * @param {string} path
  9. */
  10. export default function dynamicImport(path) {
  11. return import(isAbsolute(path) ? pathToFileURL(path).toString() : path);
  12. }