Skip to content

node-modules/tshy-after

Folders and files

NameName
Last commit message
Last commit date

Latest commit

e2321c7 · Dec 24, 2024

History

15 Commits
Dec 24, 2024
Dec 24, 2024
Dec 24, 2024
Dec 24, 2024
Dec 24, 2024
Sep 17, 2023
Dec 24, 2024
Dec 24, 2024
Sep 17, 2023

Repository files navigation

tshy-after

NPM version Node.js CI npm download Node.js Version PRs Welcome

Auto set package.json after tshy run

keep types

Set package.types to package.exports['.'].require.types

Auto fix import.meta.url and import.meta.resolve SyntaxError on CJS

SyntaxError: Cannot use 'import.meta' outside a module

e.g.: Get the file's dirname

// src/index.ts

import { fileURLToPath } from 'node:url';
import path from 'node:path';

export function getDirname() {
  if (typeof __dirname !== 'undefined') {
    return __dirname;
  }
  // @ts-ignore
  return path.dirname(fileURLToPath(import.meta.url));
}

License

MIT

Contributors

Contributors

Made with contributors-img.