passive watcher esm module
See original GitHub issueunbuild uses
await writeFile(output + '.mjs', `${shebang}import jiti from 'jiti';\nexport default jiti(null, { interopDefault: true })('${entry.input}');`)
but this results in
import jiti from 'jiti';
export default jiti(null, { interopDefault: true })('../src/index.ts');
which only do default export for esm modules (not named ones) i tried to figure it out how solve this but seems is not possible what you thing
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:9 (1 by maintainers)
Top Results From Across the Web
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 >ESM Active-Passive High Availability Module Licensing
Starting from ESM 7.2, the Active Passive High Availability (APHA) module requires one or more licenses that enable ESM and the APHA module....
Read more >unbuild | Yarn - Package Manager
Passive watcher. Stub dist once using jiti and you can try and link your project without needing to watch and rebuild during development....
Read more >Documentation - ECMAScript Modules in Node.js - TypeScript
Interoperating between the two module systems brings large challenges, with many new features to juggle; however, support for ESM in Node.js is now...
Read more >Using ECMAScript modules (ESM) with Node.js
Learn about using ES modules in Node.js today and get a closer look at how you can migrate your codebase to make use...
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
same
I think what I am seeing is this same issue, originally though it was a jiti problem, but moving details here. I am not sure stubs can currently be used with ESM as trying to use named exports doesn’t work for stubs but using the default export doesn’t work when built.
npx yarn install
npm yarn stub
test.mjs
at the root with contentsnode index.mjs
you will see the error
SyntaxError: The requested module '@nuxt/kit' does not provide an export named 'findPath'
Then run
npm run build
andnode index.mjs
again you will seefindPath
resolves fine.