Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove module.exports in esm bundle #116

Open
1 of 3 tasks
egoist opened this issue Jun 24, 2021 · 1 comment
Open
1 of 3 tasks

Remove module.exports in esm bundle #116

egoist opened this issue Jun 24, 2021 · 1 comment
Labels

Comments

@egoist
Copy link
Collaborator

egoist commented Jun 24, 2021

Issue Type

  • Bug Report
  • Feature Request
  • Other

Description

cac/src/index.ts

Lines 13 to 14 in 5060bd9

// @remove-for-deno
module.exports = cac

This should be removed in esm bundle for Node.js too.

Normally it won't cause issues, unless you're trying to bundle your CLI into a single js file.

Possible Solutions

Using a rollup plugin to remove it, could be added here: https://github.com/cacjs/cac/blob/master/rollup.config.js

Info

  • CAC version: 6.7.3
  • Reproduction link:
@egoist egoist added the bug label Jun 24, 2021
@HomyeeKing
Copy link

I also met this kind of bug in vite,
here I export a variety called SHORTCUTS from 'cli.ts', and rollup bundle it into cjs format
once some other file refenect SHORTCUTS, the bundled cli.js file just have dependency requirments and exports.SHORTCUTS=cli.SHORTCUTS, no other codes in bundle file which will crash the CI flow

how to fix this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants