Skip to content

baseUrl and paths not working on heft. #10609

@Dangerous-Mind

Description

@Dangerous-Mind

What type of issue is this?

Question

What SharePoint development model, framework, SDK or API is this about?

💥 SharePoint Framework

Target SharePoint environment

SharePoint Online

What browser(s) / client(s) have you tested

  • 💥 Internet Explorer
  • 💥 Microsoft Edge
  • 💥 Google Chrome
  • 💥 FireFox
  • 💥 Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)

Additional environment details

  • SPFx version 1.22.1
  • Node.js version 22.21.11

Issue description

I'm upgrading a SPFx solution to SPFx 1.22.1 and also to heft and I'm getting the message:
[build:webpack] lib/webparts/xxxApp/components/routes/IndexRoutes.js:9:0 - Module not found: Error: Can't resolve '@Store/Store' in 'C:\_Projects\xxxApp\lib\webparts\xxxApp\components\routes'

My tsconfig.json still has the same code that worked previously for the paths and I don't have any errors/warnings on intelisense before I make the heft build.

{
  "extends": "./node_modules/@microsoft/spfx-web-build-rig/profiles/default/tsconfig-base.json",
  "compilerOptions": {
    "target": "es2021",
    "forceConsistentCasingInFileNames": true,
    "module": "esnext",
    "moduleResolution": "node",
    "jsx": "react",
    "declaration": true,
    "sourceMap": true,
    "experimentalDecorators": true,
    "skipLibCheck": true,
    "outDir": "lib",
    "inlineSources": false,
    "noImplicitAny": true,

    "typeRoots": ["./node_modules/@types", "./node_modules/@microsoft"],
    "types": ["webpack-env"],
    "lib": [
      "es5",
      "es6",
      "es2015",
      "es2018",
      "es2021",
      "dom",
      "es2015.collection",
      "es2015.promise"
    ],
    "baseUrl": "./src",
    "paths": {
      "@Store/*": ["./store/*"],
      "@Models/*": ["./models/*"],
      "@Helpers/*": ["./helpers/*"],
      "@Common/*": ["./common/*"],
      "@Components/*": ["./components/*"],
      "@Services/*": ["./services/*"],
      "@types/*": ["./types/*"],
      "@Webparts/*": ["./webparts/*"]
    }
  },
  "include": ["src/**/*.ts", "src/**/*.tsx"]
}

Anyone know how to add paths on SPFx/heft solutions?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions