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

Webpack 5 #1681

Merged
merged 27 commits into from
Feb 23, 2021
Merged

Webpack 5 #1681

merged 27 commits into from
Feb 23, 2021

Conversation

himdel
Copy link
Contributor

@himdel himdel commented Oct 13, 2020

Updates SUI to webpack 5.4, dropping a couple of obsolete plugins/loaders.

The bulk of the change is a change in how importing html files work - previously it would return an url for use in component definition, and create a corresponding entry in angular's $templateCache; now, it returns a the content in a string, which can be passed as the component template directly.

Also updates novnc to current version, to prevent 'return' outside of function [vendor/noVNC/utils/parse.js:38,2].

And drops yarn.lock for consistency with ui-classic (and to prevent all the commits full of yarn.lock).

And karma-webpack doesn't work with webpack5, running webpack before tests and using the built output works.

Closes #1691
Closes #1692
Closes #1695

@himdel himdel added the wip label Oct 13, 2020
@himdel
Copy link
Contributor Author

himdel commented Nov 5, 2020

@miq-bot remove_label wip

Works for me locally and travis is green, ready for reviews :)

@mzazrivec
Copy link
Contributor

$ yarn build
yarn run v1.22.10
$ yarn build:git-hash && NODE_ENV="production" webpack --bail --progress --profile --config config/webpack.prod.js
$ node config/githash.js
internal/fs/utils.js:230
    throw err;
    ^

Error: ENOENT: no such file or directory, open '/home/milan/src/manage-iq/manageiq-ui-service/client/version/version.json'

@h-kataria
Copy link
Contributor

$ yarn build
yarn run v1.22.10
$ yarn build:git-hash && NODE_ENV="production" webpack --bail --progress --profile --config config/webpack.prod.js
$ node config/githash.js
internal/fs/utils.js:230
    throw err;
    ^

Error: ENOENT: no such file or directory, open '/home/milan/src/manage-iq/manageiq-ui-service/client/version/version.json'

/cc @himdel

@himdel
Copy link
Contributor Author

himdel commented Dec 9, 2020

Updated, sorry about the delay :)

I've just added a .gitkeep file to ensure the directory exists and the build can create the file again.

@Fryguy
Copy link
Member

Fryguy commented Jan 19, 2021

Gah sorry...this conflict was caused by #1694

@himdel
Copy link
Contributor Author

himdel commented Jan 25, 2021

Rebased on top of #1694 :)

`import { deconstruct } from "foo.json"` only works while it's being mapped to `const { deconstruct } = require('foo.json');`
proper import just returns a default blob, which can then be deconstructed
fails with webpack 5,
this might be working out of the box
this means we can no longer import html files as `templateUrl`
these will now import strings to use as `template`
    perl -i -npe 's/import templateUrl from (["'\''])(.*)\1;?$/import template from '\''$2'\'';/' app/**/*.js
    perl -i -npe 's/^(\s*)templateUrl,?\s*$/$1template,\n/' app/**/*.js
manual changes to update remaining use of template urls to required template strings

the one place where that doesn't work is navigation, because pf-notification-drawer assumes it can include templates by url,
manually injecting the 3 template in $templateCache
dependency on a branch comes from #296 - migration from bower; bower used ~0.6.1

and novnc has since changed the npm package name, and released a new major
bring in line with gitignore and ui-classic
@miq-bot
Copy link
Member

miq-bot commented Feb 23, 2021

Checked commits https://github.com/himdel/manageiq-ui-service/compare/dd2c69b7c5c170e00ff48d13adbaa6b42fc1de67~...8b0203b91fc3f858f5ed99fde32419400939329b with ruby 2.6.3, rubocop 0.82.0, haml-lint 0.35.0, and yamllint
1 file checked, 1 offense detected

**

  • 💣 💥 🔥 🚒 - Linter/Yaml - missing config files

@Fryguy Fryguy merged commit 8fbe42a into ManageIQ:master Feb 23, 2021
@Fryguy Fryguy assigned Fryguy and unassigned h-kataria Feb 23, 2021
@Fryguy
Copy link
Member

Fryguy commented Mar 5, 2021

Backported to lasker in commit bf40a37.

commit bf40a371144dba53193f4a3b8a5ef90184b60aff
Author: Jason Frey <fryguy9@gmail.com>
Date:   Tue Feb 23 11:12:53 2021 -0500

    Merge pull request #1681 from himdel/webpack5
    
    Webpack 5
    
    (cherry picked from commit 8fbe42aa94f5c36993e0875ef828a1b0e6c11c75)

Fryguy added a commit that referenced this pull request Mar 5, 2021
Webpack 5

(cherry picked from commit 8fbe42a)
@himdel himdel deleted the webpack5 branch March 8, 2021 15:41
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.

None yet

5 participants