Not recommended to use “use strict” in ES6?

ES6 modules are always in strict mode. To quote the relevant part of the spec: 10.2.1 Strict Mode Code An ECMAScript Script syntactic unit may be processed using either unrestricted or strict mode syntax and semantics. Code is interpreted as strict mode code in the following situations: Global code is strict mode code if it … Read more

Node.js plans to support import/export ES6 (ECMAScript 2015) modules

Node.js 13.2.0 & Above Node.js 13.2.0 now supports ES Modules without a flag 🎉. However, the implementation is still marked as experimental so use in production with caution. To enable ECMAScript module (ESM) support in 13.2.0, add the following to your package.json: { “type”: “module” } All .js, .mjs (or files without an extension) will … Read more

Is it possible to import modules from all files in a directory, using a wildcard?

I don’t think this is possible, but afaik the resolution of module names is up to module loaders so there might a loader implementation that does support this. Until then, you could use an intermediate “module file” at lib/things/index.js that just contains export * from ‘ThingA’; export * from ‘ThingB’; export * from ‘ThingC’; and … Read more

How can I use an ES6 import in Node.js? [duplicate]

Node.js has included experimental support for ES6 support. Read more about here: https://nodejs.org/docs/latest-v13.x/api/esm.html#esm_enabling. TLDR; Node.js >= v13 It’s very simple in Node.js 13 and above. You need to either: Save the file with .mjs extension, or Add { “type”: “module” } in the nearest package.json. You only need to do one of the above to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)