Questions tagged [tsconfig-paths]

69 questions
1
vote
0 answers

Cannot find module '@module/kinetic-erp-tester-e2e'/ tsconfig paths only in ubuntu

We have below error and it happens only in ubuntu, it seems to deal with tsconfig paths. tsconfig is updated like below. Please advise if different approach needs to be handled. `"paths": { "@module/kinetic-e2e": ["dist/kinetic-e2e"], …
Shreyas Murali
  • 329
  • 1
  • 2
  • 17
1
vote
0 answers

Trying to reference files in different folder in Angular project

The Scenario: I have the following structure in my Angular project: Project Folder1 tsconfig.json Folder1.1 file1.1.1 Folder1.2 file1.2.1 Folder2 tsconfig.json file2.1 tsconfig.json in Folder1 contains "paths":…
RNdev
  • 953
  • 1
  • 8
  • 26
0
votes
2 answers

Jest cannot import modules from TypeScript ESM path mapping

I'm trying to set a path mapping for the src folder and for some reason in my jest test file it is not being resolved. this is my project structure: app-esm/ ├── __test__/ │ └── index.test.ts ├── src/ │ └── index.ts ├── jest.config.ts ├──…
manga
  • 11
  • 5
0
votes
0 answers

Unable to run deploy for hardhat: import "@nomicfoundation/hardhat-toolbox"; SyntaxError: Cannot use import statement outside a module

I have folder structure like this: - hardhat.config.ts - src ---- scripts ---- contracts ---- ... ... However when I do: npx hardhat node I get the error: SyntaxError: Cannot use import statement outside a module. Here's my tsconfig file: { …
Shivam Sahil
  • 4,055
  • 3
  • 31
  • 62
0
votes
0 answers

Typescript top level await with path aliases

I want to use top level await, but at the same time not lose the ability to use path aliases, both in assembly and in developer mode. I tried to use ts-node-dev with tsconfig-paths, but got the error: "Must use import to load ES Module"
titsex
  • 11
  • 3
0
votes
1 answer

Why is the path alias I declared not resolved?

tl;dr: I am getting error TS2307 when importing a file via an alias path defined in tsconfig.json, even though I think the path should be correct. The directory structure in my Angular/nx/TypeScript project looks like this: project |- libs | …
F-H
  • 663
  • 1
  • 10
  • 21
0
votes
0 answers

MODULE_NOT_FOUND when compiling TS into JS

I have a root folder as below: root/ ├── src/ │ ├── utils/ | | ├── greeting.ts | | └── index.ts | └── index.ts src/utils/greeting.ts: export default function greeting(){} src/utils/index.ts: export { default as greeting } from…
0
votes
0 answers

ts-node & ts-config paths not working anymore?

My tsconfig looks like this (look below). I was tinkering with the target/module/moduleResolution settings and then the path aliases stopped working. I thought these options had nothing to do with it? Can anyone help me or point me in the right…
0
votes
0 answers

Cannot find package '@server/getServerOptions' using ts-node and tsconfig-paths (alias paths TS)

My problem is that even using tsconfig-paths to parse my Typescript paths, I'm still not able to make it work. Error: ^ CustomError: Cannot find package '@server/getServerOptions' imported from /Users/react-vite/server.ts My…
0
votes
0 answers

How to resolve path alias in javascript with vite.js?

I have added jsconfig.json for path alias "baseUrl": ".", "paths": { "@/*": [ "src/*" ] } Work fine with editor but npm run gives error Failed to resolve import "@/router" Relative path also works fine. module-alias plugin does not work…
mjmicro
  • 73
  • 9
0
votes
0 answers

Feathersjs with tsconfig-path not working while running with ts-node-dev

"scripts": { "dev": "ts-node-dev --no-notify -r tsconfig-paths/register src/index.ts", }, Getting following error [INFO] 12:12:54 ts-node-dev ver. 2.0.0 (using ts-node ver. 10.9.1, typescript ver. 4.9.4) TypeError: Cannot read property…
0
votes
0 answers

Absolute imports not working in typescript

I have the following folder structure: - src --- entities ----- index.ts ----- Address.ts --- initializers ----- getLoaders.ts I would like to be able to run import {Address} from "entities" in the getLoaders.ts file. However I get the error:…
sev
  • 1,500
  • 17
  • 45
0
votes
0 answers

How to config nodemon to execute emitted Javascript files from Typescript files using ts-node and tsconfig-paths?

Problem I want to use path aliasing in NodeJS + TS. To do that, I need to: declare baseUrl and paths in tsconfig.json to denote I want to use path alias (avoid import { sth } from "./../../../sth.ts" use tsconfig-paths to "load modules whose…
Sonny
  • 166
  • 1
  • 4
  • 12
0
votes
0 answers

Resolve Paths within tsconfig file

I setup custom paths within tsconfig.json file. Redwood.js is unable to find the modules when building for local dev and I get the terminal error: web | ERROR in ./src/components/GoalsEditor/GoalsFormBtns.tsx 43:0-52 web | Module not found: Error:…
Kayote
  • 14,579
  • 25
  • 85
  • 144
0
votes
1 answer

Monorepo - How to import from within and from without the package?

Yo. I have a question, that doesn't have a difinitive answer, but I would like to see the opinions of the community. Let's say we have a Monorepo, with the following…