Skip to content

Absolute imports / TS Paths aliases get treated as externals #528

@hornetDC

Description

@hornetDC

Hi. I am trying to create a small components lib + styleguidist playground.

Playground works fine (it uses webpack), but my build is broken. I created a dist folder, npm pack-ed it, installed locally in another project.

import { Button } from "components-lib";

Module not found: Can't resolve 'components/Button'

My index.ts looks like this:

export { default as Button } from "components/Button";
export { default as Checkbox } from "components/Checkbox";
export { default as Icon } from "components/Icon";
export { default as SideMenu } from "components/SideMenu";

image

I get no errors during build.

My tsconfig:

{
  "include": ["src", "@types", "test"],
  "compilerOptions": {
    "target": "es5",
    "module": "esnext",
    "lib": ["dom", "esnext"],
    "importHelpers": true,
    "declaration": true,
    "sourceMap": true,
    "rootDir": "./",
    "strict": true,
    "noImplicitAny": false,
    "strictNullChecks": false,
    "strictFunctionTypes": true,
    "noImplicitThis": true,
    "alwaysStrict": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    "moduleResolution": "node",
    "baseUrl": "./",
    "paths": {
      "*": ["src/*", "node_modules/*"]
    },
    "jsx": "react",
    "resolveJsonModule": true,
    "esModuleInterop": true,
    "isolatedModules": true,
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions