Publish non-transpiled ECMAScript module as separate package
See original GitHub issueCurrently, there is no field in package.json that can point to non-transpiled ESM, while supporting bundlers like webpack and Rollup or transpilers like Babel.
The best way to provide non-transpiled ESM seems to be providing it in the separate package, e.g., katex-es.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Publishing and consuming ECMAScript modules via packages
The ecosystem around delivering ECMAScript modules via packages is slowly maturing. This blog post explains how the various pieces fit ...
Read more >How to publish a module written in ES6 to NPM?
The pattern I have seen so far is to keep the es6 files in a src directory and build your stuff in npm's...
Read more >Publishing NPM Packages as Native ES Modules - Medium
Node.js has had native support for ES modules since version 14, here's why you should (probably) be using it, how to migrate, and...
Read more >Publish ESM and CJS in a single package - Anthony Fu
A short tutorial of shipping both ESM and CJS dual formats in a single NPM package.
Read more >How to build, test and release a node module in ES6
Let's go through step by step how to create, build and publish a package to npm that's written in ES6. Prerequisites. Ensure you've...
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 Free
Top 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

Rather than publishing a new package, I think we can use
import katex from 'katex/dist/katex'. I will make a documentation PR.@kevinbarabash But to use it in old environments with less ES6 support, which is more common use case, it needs to be transpiled to ES5. However, by default,
babel-loader(webpack) orrollup-plugin-babel(Rollup) doesn’t transpile dependencies(node_modules). It needs user-side configuration and it’d hard to configure if KaTeX is deep level dependency.