Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

233
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda