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

CLI: Prebundle boxen to resolve a ESM/CJS incompatibility #23080

Merged
merged 1 commit into from
Jun 15, 2023

Conversation

ndelangen
Copy link
Member

@ndelangen ndelangen commented Jun 15, 2023

Closes #

What I did

Users of yarn1 + storybook are running into an issue:

ℹ Storybook build output:
/home/runner/work/addon-visual-tests/addon-visual-tests/build-storybook.log

/home/runner/work/addon-visual-tests/addon-visual-tests/node_modules/boxen/index.js:8
const wrapAnsi = require('wrap-ansi');
                 ^
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/runner/work/addon-visual-tests/addon-visual-tests/node_modules/wrap-ansi/index.js from /home/runner/work/addon-visual-tests/addon-visual-tests/node_modules/boxen/index.js not supported.
Instead change the require of /home/runner/work/addon-visual-tests/addon-visual-tests/node_modules/wrap-ansi/index.js in /home/runner/work/addon-visual-tests/addon-visual-tests/node_modules/boxen/index.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/home/runner/work/addon-visual-tests/addon-visual-tests/node_modules/boxen/index.js:8:18)
    at Object.<anonymous> (/home/runner/work/addon-visual-tests/addon-visual-tests/node_modules/@storybook/core-server/dist/index.js:47:9068)
    at Object.<anonymous> (/home/runner/work/addon-visual-tests/addon-visual-tests/node_modules/@storybook/cli/dist/generate.js:1:12[55](https://github.com/chromaui/addon-visual-tests/actions/runs/5275056906/jobs/9540144634?pr=8#step:5:56))
    at Object.<anonymous> (/home/runner/work/addon-visual-tests/addon-visual-tests/node_modules/@storybook/cli/bin/index.js:9:1)
    at Object.<anonymous> (/home/runner/work/addon-visual-tests/addon-visual-tests/node_modules/storybook/index.js:3:1) {
  code: 'ERR_REQUIRE_ESM'

see: https://github.com/chromaui/addon-visual-tests/actions/runs/5275056906/jobs/9540144634?pr=8

@tmeasday investigated this and concluded it's related to:
isaacs/jackspeak#5 (comment)
https://github.com/isaacs/jackspeak/blame/main/package.json#L70

How to test

I think we'll have to do a quick alpha release to get this tested in the place where we know it happens.
I think trying to reproduce this in the monorepo will be extremely tedious and fragile, considering it only seems to happen with yarn1.

Checklist

  • Make sure your changes are tested (stories and/or unit, integration, or end-to-end tests)
  • Make sure to add/update documentation regarding your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Maintainers

  • If this PR should be tested against many or all sandboxes,
    make sure to add the ci:merged or ci:daily GH label to it.
  • Make sure this PR contains one of the labels below.

["cleanup", "BREAKING CHANGE", "feature request", "bug", "documentation", "maintenance", "dependencies", "other"]

@ndelangen ndelangen self-assigned this Jun 15, 2023
@ndelangen ndelangen added bug patch:yes Bugfix & documentation PR that need to be picked to main branch labels Jun 15, 2023
@shilman shilman changed the title Ecosystem: Prebundle boxen to resolve a ESM/CJS incompatibility CLI: Prebundle boxen to resolve a ESM/CJS incompatibility Jun 15, 2023
@shilman shilman merged commit 56b77e4 into next Jun 15, 2023
@shilman shilman deleted the norbert/boxen-prebundled branch June 15, 2023 16:44
@shilman shilman added the cli label Jun 15, 2023
shilman added a commit that referenced this pull request Jun 17, 2023
CLI: Prebundle boxen to resolve a ESM/CJS incompatibility
(cherry picked from commit 56b77e4)
@shilman shilman added the patch:done Patch/release PRs already cherry-picked to main/release branch label Jun 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cli patch:done Patch/release PRs already cherry-picked to main/release branch patch:yes Bugfix & documentation PR that need to be picked to main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants