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

Upgrade to webpack@5 #4725

Merged
merged 37 commits into from
Feb 15, 2022
Merged

Upgrade to webpack@5 #4725

merged 37 commits into from
Feb 15, 2022

Conversation

ixrock
Copy link
Contributor

@ixrock ixrock commented Jan 20, 2022

This also fixing nasty caching bug with UI files after combination(s) of make clean && make dev / page reload / git checkout branches / etc.

TODO:

  • fix unit tests
  • fix integration tests
  • fix warnings in compilation of main process (types must be imported separately in files participating in extension-api re-exports)
  • fix incorrect import warnings in compilation of renderer process
  • use @pmmmwh/react-refresh-webpack-plugin with react-refresh-typescript to support HMR in most cases

@ixrock ixrock added the enhancement New feature or request label Jan 20, 2022
@ixrock ixrock self-assigned this Jan 20, 2022
@ixrock ixrock requested a review from a team as a code owner January 20, 2022 12:44
@ixrock ixrock requested review from jakolehm and jim-docker and removed request for a team January 20, 2022 12:44
@ixrock ixrock marked this pull request as draft January 20, 2022 12:44
@ixrock ixrock force-pushed the webpack5-upgrade-attempt branch from e1629d6 to f4f937d Compare January 20, 2022 12:45
@Nokel81
Copy link
Collaborator

Nokel81 commented Jan 20, 2022

Shouldn't think be marked as a chore?

@ixrock
Copy link
Contributor Author

ixrock commented Jan 20, 2022

Shouldn't think be marked as a chore?

whatever :)

@ixrock ixrock added chore area/ui and removed enhancement New feature or request labels Jan 20, 2022
@ixrock ixrock changed the title Upgrade to webpack@5 and all relevant packages to latest versions Upgrade to webpack@5 Jan 22, 2022
@github-actions
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions
Copy link
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

@github-actions
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

…tempt

# Conflicts:
#	src/common/catalog-entities/kubernetes-cluster.ts
…'s not bundled with HtmlWebpackPlugin() anyway anda all fonts loaded via css @font-face rule

Signed-off-by: Roman <[email protected]>
…gin` to support HMR in most cases

Signed-off-by: Roman <[email protected]>
@ixrock
Copy link
Contributor Author

ixrock commented Feb 14, 2022

@lensapp/lens-maintainers PTAL, ready for testing & reviews.

HMR demo:

Screen.Recording.2022-02-14.at.16.03.19.mov

extensions/kube-object-event-status/package.json Outdated Show resolved Hide resolved
"ts-loader": "^8.0.4",
"typescript": "^4.3.2",
"webpack": "^4.46.0"
"ts-loader": "latest",
Copy link
Collaborator

Choose a reason for hiding this comment

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

We shouldn't use latest here because it will break if there is a mismatch of versions between this file and ../../package.json

Copy link
Contributor Author

@ixrock ixrock Feb 14, 2022

Choose a reason for hiding this comment

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

Why it will break when it's not used in "production" / inside packed extension?
I think only ts-loader must be compatible with local webpack package.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We do run npm install on extensions, even bundled extensions.

Copy link
Contributor Author

@ixrock ixrock Feb 14, 2022

Choose a reason for hiding this comment

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

When we do? So maybe we should move it to peerDependencies then?
Anyway I think it should be handled from parent's package version, otherwise it's just copy-pasting all around. Can we use actual versions from app's package.json on extensions install?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, it's still unclear how this installing dependency handle unpacking extension:

await this.dependencies.installExtension(extension.absolutePath);

In general it feels wrong if compiled extension require matching own development dependencies with the app (in case of react, mobx and some other packages we're sharing them via global env because version matching there is important for app's work. @jakolehm @nevalla @panuhorsmalahti wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

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

@Nokel81 @ixrock Lens installs extension npm package without development dependencies -> extension dev dependencies don't need to match same versions on Lens side.

Copy link
Contributor

Choose a reason for hiding this comment

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

Note: using latest version might still be a bit risky (in general).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's not more risky than just having outdated specific version == in both cases I assume it's easy to spot/fix/use what is needed per extension package.

webpack.extensions.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@jakolehm jakolehm left a comment

Choose a reason for hiding this comment

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

LGTM

"ts-loader": "^8.0.4",
"typescript": "^4.3.2",
"webpack": "^4.46.0"
"ts-loader": "latest",
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: using latest version might still be a bit risky (in general).

@aleksfront
Copy link
Contributor

Found 2 terminal-related issues:

  1. Fonts don't preload properly in terminal window.
    broken fonts

  2. An error occured on every terminal tab close:

Uncaught TypeError: Cannot read properties of null (reading 'url')
close.tab.error.mov

@Nokel81
Copy link
Collaborator

Nokel81 commented Feb 15, 2022

@aleksfront that second issue is a known issue that exists on master. I don't think it should block this PR

Copy link
Collaborator

@Nokel81 Nokel81 left a comment

Choose a reason for hiding this comment

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

Except for the font issue. This looks good to me.

@ixrock
Copy link
Contributor Author

ixrock commented Feb 15, 2022

Except for the font issue. This looks good to me.

fix is already done (gonna create new PR very soon)

@Nokel81 Nokel81 added this to the 5.4.0 milestone Feb 15, 2022
@ixrock ixrock merged commit d656a9e into master Feb 15, 2022
@ixrock ixrock deleted the webpack5-upgrade-attempt branch February 15, 2022 15:04
jim-docker added a commit that referenced this pull request Feb 15, 2022
@ixrock ixrock restored the webpack5-upgrade-attempt branch February 16, 2022 13:59
Nokel81 pushed a commit that referenced this pull request Feb 16, 2022
ixrock added a commit that referenced this pull request Feb 17, 2022
ixrock added a commit that referenced this pull request Feb 17, 2022
@ixrock ixrock deleted the webpack5-upgrade-attempt branch February 17, 2022 13:11
ixrock added a commit that referenced this pull request Feb 17, 2022
@ixrock ixrock mentioned this pull request Feb 17, 2022
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.

4 participants