简体   繁体   中英

cannot use alias in npm package

im trying to create a npm package that i can use in my other app. in my development i defined path in tsconfig for importing different modules instead of relative path. however, when i download my package in to test app. it cannot resolve module path.

i think if i change to using relative path then it would work.

in my tsconfig, i defined a path like this

"moduleOne": ["./moduleOne/src/index.ts"]

in my ts file where i need to import moduleOne i do

import {helper} from "moduleOne"

when i download the package in my other app i get Module not found: Error: Can't resolve 'moduleOne'

试试

import { helper } from "moduleOne"

您在导入时缺少 moduleOne 周围的字符串引号。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM