一覧へ戻る
lightyen/rollup-plugin-tsconfig-paths(新しいタブで開きます)
主要言語: TypeScript
Rollup plugin for resolving tsconfig paths
- star 数
- 6
- watcher 数
- 1
- fork 数
- 1
- issue 数
- 0
- 最終更新
- 2021/12/30
主要言語: TypeScript
Rollup plugin for resolving tsconfig paths
This repo has been moved into typescript-paths.
Rollup plugin for resolving tsconfig paths
yarn add -D rollup-plugin-tsconfig-paths
rollup.config.js
import tsPaths from "rollup-plugin-tsconfig-paths" import nodeResolve from "@rollup/plugin-node-resolve" import commonjs from "@rollup/plugin-commonjs" export default { plugins: [ tsPaths(), nodeResolve({ extensions: [".tsx", ".ts", ".jsx", ".js", ".json", ...] }), commonjs(), ] }
Example tsconfig.json
{
"compilerOptions": {
"jsx": "preserve",
"module": "esnext",
"moduleResolution": "node",
"target": "esnext",
"lib": ["esnext", "dom", "dom.iterable"],
"types": ["react", "webpack-env"],
"baseUrl": ".",
"paths": {
"~/*": ["./*"]
}
}
}Then you can import alias instead of annoying path
// import App from "../../../../App" import App from "~/App" ...
Specify set where your TypeScript configuration file.
If not set:
Log level when the plugin is running.