I'm in the process of converting an older typescript project into a library for a new vue.js project. The previous package is set up to output to ./lib/
using tsconfig.json
, and all the necessary "this is where my library is" configurations are included in package.json
. When I compile with tsc
, everything gets compiled to lib/
in the old package, and I'm utilizing npm link
to link the packages together.
However, no matter what I attempt, I can't seem to get rid of the lib/
segment from my imports. For instance, I want to do something like
import { baz } from "older/common/thing"
instead of import { baz } from "older/lib/common/thing"
. Is there a way to achieve cleaner imports or should I just accept it as is?
package.json
(partial)
{
"main": "./lib/index.js",
"module": "./lib/index.js",
"types": "./lib/index.d.ts",
}
tsconfig.json
{
"compilerOptions": {
"module": "es6",
"target": "es6",
"moduleResolution": "node",
"noImplicitAny": true,
"noUnusedLocals": true,
"removeComments": true,
"preserveConstEnums": true,
"allowSyntheticDefaultImports": true,
"importHelpers": true,
"sourceMap": true,
"typeRoots": [
"typings",
"node_modules/@types"
],
"outDir": "./lib",
"declaration": true
},
"include": [
"app/source/**/*",
"test/**/*"
],
"exclude": [
"node_modules"
]
}