@dangao/node-alias
    TypeScript icon, indicating that this package has built-in type declarations

    0.2.3 • Public • Published

    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

    Install

    npm i @dangao/node-alias

    DownloadsWeekly Downloads

    7

    Version

    0.2.3

    License

    MIT

    Unpacked Size

    5.42 kB

    Total Files

    12

    Last publish

    Collaborators

    • dangao