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

Builder-Vite: Fix 'condition node never be used' warning #28989

Merged
merged 1 commit into from
Aug 28, 2024

Conversation

valentinpalkovic
Copy link
Contributor

@valentinpalkovic valentinpalkovic commented Aug 28, 2024

Closes n/A

What I did

I have removed the node export in some of our Storybook packages in the case, where an import and a require export statement exists beforehand. That avoids warnings from Vite saying: "The condition 'node' here will never be used as it comes after both 'import' and 'require'" [package.json]

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

  1. Run a Vite-based sandbox for template, e.g. yarn task --task sandbox --start-from auto --template react-vite/default-ts
  2. Open Storybook in your browser
  3. Take a look at your terminal. The warning "The condition 'node' here will never be used as it comes after both 'import' and 'require'" shouldn't appear.

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>

name before after diff z %
createSize 0 B 0 B 0 B - -
generateSize 76.4 MB 76.4 MB 0 B 0.5 0%
initSize 161 MB 161 MB 57.8 kB -0.88 0%
diffSize 84.8 MB 84.8 MB 57.8 kB -0.89 0.1%
buildSize 7.48 MB 7.48 MB 0 B 3 0%
buildSbAddonsSize 1.62 MB 1.62 MB 0 B 0.72 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 2.31 MB 2.31 MB 0 B 3 0%
buildSbPreviewSize 352 kB 352 kB 0 B 0.73 0%
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 4.47 MB 4.47 MB 0 B 3 0%
buildPreviewSize 3.01 MB 3.01 MB 0 B 2.99 0%
testBuildSize 0 B 0 B 0 B - -
testBuildSbAddonsSize 0 B 0 B 0 B - -
testBuildSbCommonSize 0 B 0 B 0 B - -
testBuildSbManagerSize 0 B 0 B 0 B - -
testBuildSbPreviewSize 0 B 0 B 0 B - -
testBuildStaticSize 0 B 0 B 0 B - -
testBuildPrebuildSize 0 B 0 B 0 B - -
testBuildPreviewSize 0 B 0 B 0 B - -
name before after diff z %
createTime 7s 7.7s 720ms -1.19 9.3%
generateTime 19.7s 22.7s 2.9s 0.45 13%
initTime 16s 18s 1.9s 0.62 10.8%
buildTime 11.5s 10.4s -1s -132ms -2.19 🔰-10.9%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 6.9s 7.2s 277ms -0.17 3.8%
devManagerResponsive 4.5s 4.6s 72ms -0.31 1.5%
devManagerHeaderVisible 793ms 767ms -26ms -0.46 -3.4%
devManagerIndexVisible 830ms 805ms -25ms -0.44 -3.1%
devStoryVisibleUncached 1.4s 1.4s 91ms 0.57 6.1%
devStoryVisible 829ms 813ms -16ms -0.36 -2%
devAutodocsVisible 745ms 652ms -93ms -0.99 -14.3%
devMDXVisible 677ms 661ms -16ms -0.63 -2.4%
buildManagerHeaderVisible 791ms 684ms -107ms -0.89 -15.6%
buildManagerIndexVisible 793ms 692ms -101ms -0.87 -14.6%
buildStoryVisible 868ms 772ms -96ms -0.5 -12.4%
buildAutodocsVisible 760ms 624ms -136ms -1.4 🔰-21.8%
buildMDXVisible 952ms 638ms -314ms -0.59 -49.2%

Greptile Summary

This PR removes the 'node' export condition from package.json files across multiple Storybook packages to address Vite warnings about unused conditions.

  • Removed 'node' export condition from 28 package.json files in various Storybook addons and renderers
  • Simplifies export configurations to improve compatibility with Vite-based projects
  • Retains 'import' and 'require' conditions to maintain functionality for different module systems
  • Changes affect core addons like a11y, actions, controls, and renderers for React, Vue3, and Svelte
  • No functional changes expected; modifications aim to resolve Vite warnings only

Copy link

nx-cloud bot commented Aug 28, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 27d871c. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

@valentinpalkovic valentinpalkovic marked this pull request as ready for review August 28, 2024 11:29
@valentinpalkovic valentinpalkovic merged commit d51101a into next Aug 28, 2024
62 of 72 checks passed
@valentinpalkovic valentinpalkovic deleted the valentin/fix-vite-warning-node-condition branch August 28, 2024 11:29
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

30 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

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

Successfully merging this pull request may close these issues.

2 participants