Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

tshy-after

node-modules2.7kMIT1.4.1TypeScript support: included

Auto set package.json after tshy run

tshy

readme

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.

changelog

Changelog

1.4.1 (2025-02-02)

Bug Fixes

  • make sure copy file parent dir exits (#5) (19c442a)

1.4.0 (2024-12-24)

Features

  • auto fix import.meta.resolve SyntaxError on CJS (#4) (de6aa45)

1.3.1 (2024-12-22)

Bug Fixes

1.3.0 (2024-12-22)

Features

  • auto copy egg meta properties (#3) (8b1be69)

1.2.0 (2024-07-08)

Features

  • auto copy image/json/web files (#2) (b7c740a)

1.1.1 (2024-07-07)

Bug Fixes

  • only replace (import.meta.url) (84efce4)

1.1.0 (2024-07-07)

Features

  • support to use import.meta.url on commonjs (#1) (155cb48)

1.0.0 (2023-09-17)

Features

  • keep types on package.json (d79e8fc)