Skip to content

Minify JS extensions by default on app dev #5864

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

Merged
merged 2 commits into from
May 22, 2025
Merged

Conversation

gonzaloriestra
Copy link
Contributor

@gonzaloriestra gonzaloriestra commented May 21, 2025

WHY are these changes introduced?

Fixes #5825
Fixes https://github.com/Shopify/develop-app-outer-loop/issues/1533

WHAT is this pull request doing?

Enables minification by default on JS extensions while running app dev.

This is basically the same as @keiraarts suggested in #5831 (thanks!), but adding a flag to ensure we can keep the current behavior, so that users can debug more easily if needed.

How to test your changes?

  • npm i -g @shopify/[email protected] --@shopify:registry=https://registry.npmjs.org
  • shopify app init --template none --name minify-app
  • cd minify-app
  • shopify app generate extension --template admin_action --name admin-action --flavor typescript
  • shopify app dev => wait until it's ready and quit
  • cat .shopify/dev-bundle/{your-extension-id}/dist/admin-action.js => minified
  • SHOPIFY_CLI_DISABLE_MINIFICATION_ON_DEV=1 shopify app dev => wait until it's ready and quit
  • cat .shopify/dev-bundle/{your-extension-id}/dist/admin-action.js => not minified

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

@gonzaloriestra

This comment was marked as outdated.

Copy link
Contributor

github-actions bot commented May 21, 2025

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
77.95% (+0.02% 🔼)
12422/15935
🟡 Branches
72.13% (+0.03% 🔼)
6022/8349
🟡 Functions
78.21% (-0.01% 🔻)
3260/4168
🟡 Lines
78.4% (+0.02% 🔼)
11753/14992

Test suite run success

2855 tests passing in 1251 suites.

Report generated by 🧪jest coverage report action from 755e25e

@gonzaloriestra

This comment was marked as outdated.

1 similar comment
@gonzaloriestra
Copy link
Contributor Author

/snapit

Copy link
Contributor

🫰✨ Thanks @gonzaloriestra! Your snapshot has been published to npm.

Test the snapshot by installing your package globally:

pnpm i -g @shopify/[email protected]

Tip

If you get an ETARGET error, install it with NPM and the flag --@shopify:registry=https://registry.npmjs.org

Caution

After installing, validate the version by running just shopify in your terminal.
If the versions don't match, you might have multiple global instances installed.
Use which shopify to find out which one you are running and uninstall it.

Copy link
Contributor

@alfonso-noriega alfonso-noriega left a comment

Choose a reason for hiding this comment

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

LGTM!🚀

@keiraarts
Copy link

/snapit

Could you please snapshot the version 3.80.4 with this pull request? @gonzaloriestra

The 3.80.0 version that your snapshot uses has a different authentication error #5826 that I believe was fixed?

@gonzaloriestra
Copy link
Contributor Author

@keiraarts that fix is already included in this branch (and snapshot). But we are still working on improving it.

@gonzaloriestra gonzaloriestra added this pull request to the merge queue May 22, 2025
Merged via the queue into main with commit 9edd6e1 May 22, 2025
31 checks passed
@gonzaloriestra gonzaloriestra deleted the minify-on-dev branch May 22, 2025 10:46
@kpeatt
Copy link

kpeatt commented May 29, 2025

@gonzaloriestra This is still broken on latest for me.

@gonzaloriestra
Copy link
Contributor Author

@kpeatt could you please share more details? Ideally opening a new issue.

@keiraarts
Copy link

Sorry to bump this thread, the authentication is not reliable on this version. Every five minutes the CLI requests a re-login.

May I request a 3.75.4 Shopify snapshot with minification feature flag? It's the best of both worlds and my team can ship code! It would help us tremendously because the authentication being unreliable (and uncertain if it's because of packet loss on internet connection?) is slowing down our ability to get a big draft extension uploaded.

@keiraarts
Copy link

image

@gonzaloriestra

@gonzaloriestra
Copy link
Contributor Author

@keiraarts could you try with @shopify/[email protected]? That version should handle errors updating the drafts in a better way, so you can just retry if it fails, instead of crashing. It's a snapshot of this PR that I hope to include in the release next week.

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

Successfully merging this pull request may close these issues.

[Bug]: Code minimization does not happen in app dev but does in app build.
5 participants