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

238
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
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