Consider building ESM for browser.
See original GitHub issueTL;DR: For ES modules to work in a browser, import statements need the .js
extension on them. https://github.com/Zoltu/typescript-transformer-append-js-extension/ is a a TypeScript transformer that will do that for you automatically during build.
For a detailed description of the problem see the Motivation section of https://github.com/Zoltu/typescript-transformer-append-js-extension/. For a solution, see the Usage section of the same repository.
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Life with ESM | CSS-Tricks
ESM, meaning ES Modules, meaning JavaScript Modules. Like, import and friends. Browsers support it these days. There is plenty of nuance, ...
Read more >Use ESM build in modern browser (<script type="module ...
If we make a production, minified ESM build, that would support this feature. As a workaround, I think if you run tsdx build...
Read more >Using ES modules in browsers with import-maps
In this post, we'll go through a few basic examples of how ES modules are used and then explore the possibility of using...
Read more >All you need to know to move from CommonJS to ECMAScript ...
Because ESM implementation in Node.js and the browser conforms to the exact specification, we can share code between server and client runtime.
Read more >How to Create a Hybrid NPM Module for ESM and CommonJS.
Build the source twice, once for ESM and once for CommonJS. We use Typescript as our transpiler, and author in ES6/ES-Next or Typescript....
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
Totally agreed, we should support future technologies.
In the apprun@latest release, the apprun.js is the UMD and ES5 build.
In the apprun@es6 release, the apprun.js is the UMD and ES2015 build. The apprun.esm.js is the ESM and ES2015 build, which is defined as pkg.module.
I hope someday I can make apprun@es6 as the default and latest.
If you really want unbundled modules, try this
unpkg.com can serve the modules dynamically by using the ?module parameter.