I'm currently searching since hours how to import local ES6 modules with an absolute path.
Whenever I try to import something in a module like :
import { Module } from "src/my-module";
I get an error "Error: Cannot find module 'src/my-module'. Here is my tsconfig :
{
"compilerOptions": {
"lib": \["ES6"\],
"target": "ES6",
"baseUrl": "./",
"rootDir": "src",
"esModuleInterop": true,
"moduleResolution": "node",
}
"include": \["src/\*\*/\*.ts"\],
"exclude": \["node_modules"\]
}
I tried to fill the paths attribute of compilerOptions in tsconfig, modifying baseUrl, installing typescript-transform-paths, ilearnio/module-alias ... I'm using ts-node
Cannot find module 'src/my-moduleis self-explanatory - it means your module is not inside the folder you are trying to import it from. Make sure you are importing it from the correct directory.import { Module } = require("src/my-module");isn't a valid operation, we can't assign require to an import definition