Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

232
Vistas
jsconfig.json paths for modules in node_modules

I have following file structure:

project
├── process
│   └── MyProjectLib
│       └── process.js
├── node_modules
│   └── MyModule
│       └── process
│           └── MyModuleLib
│               └── process.js
└── jsconfig.json

Content of process.js in MyModuleLib:

export function myModuleFunction()
{
    return "hallo";
}

Content of process.js in MyProjectLib:

function myProjectFunction()
{
    var x = myModuleFunction();

    return x + " myModuleFunction";
}

Now I need an import in MyProjectLib.process.js

It has to be in this format (I cannot change it, this needs my application):

import { myModuleFunction } from "MyModuleLib";

But currently it looks like

import { myModuleFunction } from "MyModule/process/MyModuleLib/process";

My jsconfig.json:

{
    "compilerOptions": {
      "module": "es6",      
      "moduleResolution": "node",
      "baseUrl": ".",
      "allowSyntheticDefaultImports": true,
      "checkJs": true,
      "noEmit": true,
      "removeComments": true,
      "strict": false,
      "paths": {
        "*": [ "MyModule/process/MyModuleLib/process"]
      }
    },
    "include": ["**/*.js", "node_modules/**/process/*/process.js"],
}

The content of node_modules cannnot be changed. I tried to modfiy it with "paths" but it doesn't work. How can I route the import so it looks like i want?

In the best case the solution should not be specific to "MyModule", though it should work with similar modules in the directory "node_modules".

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda