npm.io
2.2.5 • Published 9 months ago

@flatjs/forge-plugin-ts-paths

Licence
MIT
Version
2.2.5
Deps
2
Size
17 kB
Vulns
0
Weekly
0

@flatjs/forge-plugin-ts-paths

faltjs plugin to automatically resolve path aliases set in the compilerOptions section of tsconfig.json. Don't use it if you're already using rollup-plugin-typescript. This plugin is only for use cases where your TypeScript code has already been transpiled before rollup runs.

// tsconfig.json
{
  "compilerOptions": {
    // ...
    "baseUrl": ".",
    "paths": {
      "@utils": ["src/helpers/utils"]
    }
  }
}
import { something } from '@utils';

Then this plugin will make sure that rollup knows how to resolve @utils.

Notes

typescript is a CommonJS module, which may not support all module.exports as named exports. CommonJS modules can always be imported via the default export, for example using:

import ts from 'typescript;`