Search posts, tags, users, and pages
CommonJs and ECMAScript module are the most famous module system in the javascript ecosystem. Before we consider why we should not use the CommonJs module system on the client-side, let's look at what exactly CommonJs and ESM are and how do they work...
pranshu shah
@pranshushah
frontend-engineer
Markdown supported · ⌘↵ to post
Manh Do
Great article. How can I import a package which only publish their code as esm without having to set type: "module" in my package.json?
I think you can use .mjs extension to tell JavaScript engine that this file is ESM module not a script file. but I think setting type: module in package.json is better option
.mjs
type: module
Manh Do
Great article. How can I import a package which only publish their code as esm without having to set type: "module" in my package.json?