microsoft / tslib

Runtime library for TypeScript helpers.
BSD Zero Clause License
1.24k stars 124 forks source link

Why do I get compilation results of tslib imports containing native absolute path? #238

Closed yoyo837 closed 6 months ago

yoyo837 commented 6 months ago

I use rollup and @rollup/plugin-typescript to compile ts and tsx codes containing annotations. I found the code that uses absolute paths to reference tslib from the outpu files. Can anyone tell me how to solve it? What did I miss?

image

tsconfig.json:

{
  "compilerOptions": {
    "baseUrl": "./",
    "rootDir": "./",
    "target": "esnext",
    "module": "esnext",
    "moduleResolution": "node",
    "strict": false,
    "jsx": "react",
    "jsxFactory": "QuarkElement.h",
    "jsxFragmentFactory": "QuarkElement.Fragment",
    "sourceMap": false,
    "declaration": false,
    "removeComments": true,
    "resolveJsonModule": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "strictNullChecks": true,
    "experimentalDecorators": true,
    "lib": ["esnext", "dom"],
    "types": ["vite/client", "./index.d.ts"],
  },
  "include": [
    "src/**/*.ts",
    "src/**/*.d.ts",
    "src/**/*.tsx",
    ".eslintrc.cjs",
    ".prettierrc.cjs",
    ".stylelintrc.cjs",
    "postcss.config.cjs",
    "babel.config.cjs",
    "rollup.config.mjs",
    "vite.config.mts",
    "typesGenerat.mjs"
  ],
  "exclude": ["node_modules", "lib", "umd"]
}
jakebailey commented 6 months ago

I don't think this has anything to do with tslib, but with your bundler. You should ask on the rollup or rollup-typescript trackers.

yoyo837 commented 6 months ago

Thanks for your reply.