Skip to content
New issue

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

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

Already on GitHub? # to your account

Migrate to Webpack v5 #2685

Merged
merged 7 commits into from
Jan 31, 2024
Merged

Migrate to Webpack v5 #2685

merged 7 commits into from
Jan 31, 2024

Conversation

rudyflores
Copy link
Contributor

@rudyflores rudyflores commented Jan 24, 2024

Proposed changes

Fixes #2214

Webpack v5 migration docs: https://webpack.js.org/migrate/5/

Migrated our outdated webpack v4 to the newest release of webpack v5, this has introduced some really good things for our repo, as well as things that we should all know about when reviewing this PR:

Code Splitting and Minimization

Code splitting using vendor strategy was used for optimizing load times on our project, see here for reference on how that was achieved: https://blog.jakoblind.no/code-split-vendors-with-webpack-for-faster-load-speed/

Minimization of our code was also integrated into our bundle for Zowe Explorer, which now greatly reduces the extension.js file size using Webpack's built in minimzer using Terser and ESBuild: https://webpack.js.org/plugins/terser-webpack-plugin/

Bundling for VS Code for web and VS Code Desktop Versions

VS Code has a recommended way of setting up initially the webpack.config.js, this repo now follows (mostly) those recommendations. A thing to note is that our repo currently uses fs which are node.js API's that can't be used in the web and cause issues with bundling. We didn't notice this before with v4 since we were already bundling as node instead of VS Code's recommended webworker target to support both platforms in one bundle. See more on this here: https://code.visualstudio.com/api/working-with-extensions/bundling-extension

Future things to address

Webpack no longer resolves polyfills automatically like in v4, which means if we switch the target to webworker we need to add those polyfill resolutions through fallbacks: https://webpack.js.org/configuration/resolve/#resolvefallback

Even if the work above is done, we need to discuss the approach to handle fs being used across Zowe Explorer and Zowe Explorer API in order to bundle for web and support that too (if we choose to support it).

Release Notes

Milestone: v3 pre-releases

Changelog: Migrated to Webpack v5

Types of changes

What types of changes does your code introduce to Zowe Explorer?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Updates to Documentation or Tests (if none of the other choices apply)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This checklist will be used as reference for both the contributor and the reviewer

  • I have read the CONTRIBUTOR GUIDANCE wiki
  • PR title follows Conventional Commits Guidelines
  • PR Description is included
  • gif or screenshot is included if visual changes are made
  • yarn workspace vscode-extension-for-zowe vscode:prepublish has been executed
  • All checks have passed (DCO, Jenkins and Code Coverage)
  • I have added unit test and it is passing
  • I have added integration test and it is passing
  • There is coverage for the code that I have added
  • I have tested it manually and there are no regressions found
  • I have added necessary documentation (if appropriate)
  • Any PR dependencies have been merged and published (if appropriate)

Further comments

Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com>
@rudyflores rudyflores self-assigned this Jan 24, 2024
@rudyflores rudyflores changed the base branch from main to next January 24, 2024 17:18
@rudyflores rudyflores changed the title Migrate webpack [WIP] Migrate webpack Jan 24, 2024
@rudyflores rudyflores changed the title [WIP] Migrate webpack [WIP] Migrate to Webpack v5 Jan 24, 2024
@rudyflores rudyflores added this to the v3 pre-releases milestone Jan 24, 2024
Copy link

codecov bot commented Jan 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (80caabd) 93.34% compared to head (841e5f7) 93.34%.
Report is 3 commits behind head on next.

Additional details and impacted files
@@           Coverage Diff           @@
##             next    #2685   +/-   ##
=======================================
  Coverage   93.34%   93.34%           
=======================================
  Files         109      109           
  Lines       10148    10148           
  Branches     2134     2134           
=======================================
  Hits         9473     9473           
  Misses        674      674           
  Partials        1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com>
Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com>
Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com>
@rudyflores rudyflores marked this pull request as ready for review January 24, 2024 21:10
@rudyflores rudyflores changed the title [WIP] Migrate to Webpack v5 Migrate to Webpack v5 Jan 24, 2024
Copy link
Contributor

@JillieBeanSim JillieBeanSim left a comment

Choose a reason for hiding this comment

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

the changes built and packaged without errors but I get this when trying to launch the debugger and that fails
Screenshot 2024-01-26 at 4 19 09 PM

@t1m0thyj
Copy link
Member

t1m0thyj commented Jan 26, 2024

the changes built and packaged without errors but I get this when trying to launch the debugger and that fails Screenshot 2024-01-26 at 4 19 09 PM

This happened to me recently too but I don't think its a problem with this PR - if you installed a new Node version with nvm recently, might need to reinstall pnpm globally (npm install -g pnpm)?

@JillieBeanSim JillieBeanSim self-requested a review January 29, 2024 12:27
JillieBeanSim
JillieBeanSim previously approved these changes Jan 29, 2024
Copy link
Contributor

@JillieBeanSim JillieBeanSim left a comment

Choose a reason for hiding this comment

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

remembering to reinstall pnpm after each node update will have to be something I remember to do now lol don't even remember updating node since last time testing next. Thanks @t1m0thyj
LGTM! thanks for the updates @rudyflores

Copy link
Member

@traeok traeok left a comment

Choose a reason for hiding this comment

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

Thanks for all your work on this @rudyflores! I do have a small request:

I ran into an issue that isn't directly related to this PR, but: I am unable to run the watch script after downgrading my Node version to v18.

On line 24 in .vscode/tasks.json, the type is set to "process" instead of "shell" - because of this, the task fails on Windows with OS error 193 because it tries to execute the Linux/macOS binary (which is not a valid Win32 application).

Can you please update this type to "shell"? This should resolve the watch script failures on Windows.

.vscode/tasks.json Outdated Show resolved Hide resolved
Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com>
@rudyflores
Copy link
Contributor Author

@traeok good catch! Should be all fixed now :)

traeok
traeok previously approved these changes Jan 29, 2024
Copy link
Member

@traeok traeok left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the tech. currency and for quickly resolving the watch task 😁

@traeok traeok self-requested a review January 29, 2024 21:48
@traeok
Copy link
Member

traeok commented Jan 29, 2024

I noticed after approving that the changelog headers have the next snapshot as the header instead of "Recent Changes" - I think that will resolve the failing changelog stage

update (1/30): I see that the changelog is still failing, not sure why that is though because the FTP extension changelog seems to have the right layout.

Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com>
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions

8.7% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

@traeok traeok mentioned this pull request Jan 30, 2024
16 tasks
Copy link
Contributor

@JillieBeanSim JillieBeanSim left a comment

Choose a reason for hiding this comment

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

LGTM! thanks @rudyflores for this update

@JillieBeanSim JillieBeanSim merged commit 41aade7 into next Jan 31, 2024
17 of 19 checks passed
@JillieBeanSim JillieBeanSim deleted the migrate-webpack branch January 31, 2024 16:25
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants