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

243
Visualizações
InterlliJ: CommonJS exports default object properties not accessible via dot notation

Given following content of an import...

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _default = {
  SOME_CONSTANT: 'Some constant text'
};
exports["default"] = _default;

...transpiled from an original ES6 export via babel...

export default {
  SOME_CONSTANT: 'Some constant text'
}

...why would my IDE (PHPStorm / IntelliJ) report the following (dot notation) as unresolved variable...?

import textConstants from 'package-name/path/to/textConstants'

console.log(textConstants.SOME_CONSTANT)

If I convert it to (bracket notation)...

console.log(textConstants["SOME_CONSTANT"])

...inspections get satisfied, no warning is showing.

Why?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It looks like adding...

{ "modules": false }

...to my .babelrc file as an option to the "@babel/preset-env" preset does the trick.

So the content of my .babelrc file is...

{
  "presets": [
    ["@babel/preset-env", { "modules": false }]
  ]
}

...while my dev dependencies in package.json file are...

{
  "devDependencies": {
    "@babel/cli": "^7.15.4",
    "@babel/core": "^7.15.5",
    "@babel/preset-env": "^7.15.6"
  }
}
about 4 years ago · Juan Pablo Isaza Relatório
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