Use .mjs for JavaScript modules
See original GitHub issueSquoosh is mostly using TypeScript (.ts
), but it also uses .js
for https://github.com/GoogleChromeLabs/squoosh/blob/master/src/lib/fix-pmc.js despite it being a module.
Let’s follow our own advice and use .mjs
to denote JS modules as opposed to classic scripts.
If this is a problem for our current toolchain, it would be good to identify the problem and raise it upstream.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How to use MJS files in Node.js? - DEV Community
1. Create a ES Module / MJS File · 2. Import your code · 3. Set your package type to "module".
Read more >JavaScript modules - MDN Web Docs
This guide gives you all you need to get started with JavaScript module syntax.
Read more >MJS - Node.js ES Module Javascript File
A file with .mjs extension is a JavaScript source code file that is used as an ECMA Module (ECMAScript Module) in Node.js applications....
Read more >What is the difference between .js and .mjs files?
mjs an extension for EcmaScript modules · An MJS file is a source code file containing an ES Module (ECMAScript Module) for use...
Read more >Files with .mjs extension for JavaScript modules - Medium
mjs is the extension for EcmaScript module files. Node.js or webpack are already handling them and we better know what it means before...
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
Grabbing this since it’s a quick change.
@mathiasbynens - we need to get Webpack to include
.mjs
in its list of default extensions for module resolution.and maybe you should consider my suggestion to turn all files into .js then marking the package in package.json as type: module and use typescript with checkJs: true flag and use JSDOC annotations you can then still type check while working with nativ modules till they accept .mjs