Can no longer import micromustache v6 using ECMAScript Modules
See original GitHub issuePrior to v6, you could use ECMAScript Modules with Node and this package.
For some reason, there isn’t the export for render in the current build. I am using this package inside a bigger project and this is the only time I’ve come across an error with a Node package.
The code I am trying to run:
import {render} from 'micromustache';
console.log("Hello, world!");
The result when running with node --es-module-specifier-resolution=node --experimental-modules index.mjs
:
import {render} from 'micromustache';
^^^^^^
SyntaxError: The requested module 'micromustache' does not provide an export named 'render'
at ModuleJob._instantiate (internal/modules/esm/module_job.js:91:21)
at async ModuleJob.run (internal/modules/esm/module_job.js:106:20)
at async Loader.import (internal/modules/esm/loader.js:132:24)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! micromustache-demo@1.0.0 start: `node --es-module-specifier-resolution=node --experimental-modules index.mjs`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the micromustache-demo@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Sample repro: https://github.com/gda-gp/micromustache-demo
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
When using ECMAScript 6 modules, cannot import a ... - GitHub
The correct way to solve this in the Closure Compiler is to have an --es6-entry-point option, which specifies the root file of your...
Read more >ES2015 "import" not working in node v6.0.0 with with
I am using node v6.0.0 and wanted to use ES2016 (ES6). However I realized that the "import" syntax is not working. Isn't "import"...
Read more >ECMAScript modules | Node.js v19.3.0 Documentation
No require , exports , or module.exports #. In most cases, the ES module import can be used to load CommonJS modules. If...
Read more >Announcing core Node.js support for ECMAScript modules
Node.js 13.2.0 ships support for ECMAScript modules, known for their import and export statements. This support was previously behind ...
Read more >ES Modules and Node.js: Hard Choices - NodeSource
ES Modules syntax defined, but ECMAScript does not define a "Loader" spec for how Modules are inserted into the Mode.js runtime.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I verified the bug. Something fishy is going on as the commonjs version of the module works:
I also verified that using esm shows the same symptom.
A workaround is to call it like this:
I’ll investigate further and make a patch ASAP. Thanks for reporting this.
@gda-gp could you verify if it’s good now?