igorskyflyer / npm-modern-module

πŸ€– Modern Module is a zero-config modern npm package starter template. 🌠

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸ€– Modern Module 🌠

πŸ€– Modern Module is a zero-config starter template that allows you to create modern npm packages with support for both CommonJS modules (Node) and ES modules (browser + Node) out of the box providing no-hassle modern creating of modules. 🌠


By using it you are creating a hybrid-module and a cross-over until ES modules become a standard in Node too and CommonJS modules become obsolete. πŸ€Έβ€β™‚οΈ


Features

🌷  Node support,
        CommonJS modules and ES modules compatible

πŸ’«  browser supportΒΉ - ES modules compatible,
        other module systems are available too

⚑  zero-config,

πŸ”₯  JavaScript supported,

β˜„οΈ  TypeScript supported,

🌟  modules interoperability,

🌴  tree-shaking supported,

🌊  single codebase for you to mantain,

🐦  codebase written in ES modules style,

🦜  type-checked codebase,

🐳  TypeScript declarations (*.d.ts) exported by default,

🦘  transpilation supported.


ΒΉ - if you don't use Node-specific code, of course.



πŸ™‹β€β™‚οΈ For compatibility reasons this starter uses .js file extension for the ES modules code and .cjs for CommonJS module code which in turn allows ES modules to be consumed by both Node and compatible browsers while also fixing a Node module lookup issue which currently occurs in Visual Studio Code and probably other Node-compatible editors/IDEs causing them to show an error when importing .mjs modules. CommonJS modules .cjs behave as expected. Also, TypeScript compiler doesn't support non-.js files when generating d.ts declaration files.

Another thing to consider, when consuming ES modules, (most) servers are not configured to serve .mjs files with a mime type of application/javascript which is necessary for JavaScript files (including modules) to work properly while the same does not happen when ES modules have the "regular" .js extension.

About

πŸ€– Modern Module is a zero-config modern npm package starter template. 🌠

License:MIT License


Languages

Language:JavaScript 100.0%