Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

233
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!