@dangao/node-alias
v0.2.3
Published
node alias
Downloads
11
Maintainers
Readme
node-alias
node module alias
install
npm i @dangao/node-alias --save
or
yarn add @dangao/node-alias
Fix
- To solve the problem that nodejs cannot use path mapping
before
// in {workspace}/src/service/xx/xxx.ts
import file from "../../../utils/xx";
after
// in {workspace}/src/env.ts
// Configuration alias
import alias from "@dangao/node-alias";
alias.add("~", __dirname);
// in {workspace}/src/main.ts
// Import it in your entry file
import "./env";
// in {workspace}/src/service/xxx.ts
// Use it anywhere in the project
import file from "~/utils/xx";
- Resolve module dependency alias conflicts