Skip to content

Latest commit

 

History

History
55 lines (45 loc) · 932 Bytes

use_as_npm_node.md

File metadata and controls

55 lines (45 loc) · 932 Bytes

作为 npm node 模块使用

配置参考

package.json

{
// ......
  "devDependencies": {
    "@dmemory/fridacontainer": "latest"
  }
}

tsconfig.json

{
  "compilerOptions": {
    "target": "ESNEXT",
    "module": "ESNEXT",
    "allowJs": true,
    "strict": true,
    "moduleResolution": "node",
    "baseUrl": "./",
    "paths": {
      "fridacontainer/*": [
        "./node_modules/@dmemory/fridacontainer/dist/*"
      ]
    },
    "skipLibCheck": true,
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true
  }
}

安装 node

sudo npm install

引用

因为在 tsconfig.jsonbaseUrlpaths 重定向了搜索路径为 fridacontainer,所以下面可以缩短导入路径长度。

import {FCAnd} from "fridacontainer/FCAnd"

function main() {
    FCAnd.hook_url(true);
}