Category "es6-modules"

How do I detect if an ES Module is the main module?

How can I detect if an ECMAScript module is the main module? This is easy for CommonJS modules (see Detect if called through require or directly by command line

ES6 modules - imported constants undefined if not in React component

The only similar question I have found is this one but I can't see how would I have caused a circular dependancy in this case: I have a file exporting constants

ExpressJs is return error `ERR_MODULE_NOT_FOUND` if I import the file without `js` extension

I build a expressJs app by ES6 and I got the below error: (node:4132) ExperimentalWarning: The ESM module loader is experimental. internal/modules/run_main.js:

Is there any way to mock private functions with Jest?

The ES6 module that I want to test looks as follows: function privateFunction() { ... } export function publicFunction() { ... does something ... priva

Re-export default in ES 6 modules

In ES6, is it possible to shorten the following code. I have an App.js file and an index.js. index.js import App from './App'; export default App; Somethin

Error [ERR_REQUIRE_ESM]: How to use es6 modules in node 12?

From https://2ality.com/2019/04/nodejs-esm-impl.html Node 12 should support es6 modules; however, I just keep getting the error: Question: How do I make a MVP