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

Bump WDP revision to address memory leak #13943

Merged
merged 8 commits into from
Jul 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ deps = {
"vendor/bat-native-tweetnacl": "https://github.com/brave-intl/bat-native-tweetnacl.git@800f9d40b7409239ff192e0be634764e747c7a75",
"vendor/challenge_bypass_ristretto_ffi": "https://github.com/brave-intl/challenge-bypass-ristretto-ffi.git@c5d6d74fdbee467732bcb6b9084514839e656286",
"vendor/gn-project-generators": "https://github.com/brave/gn-project-generators.git@b76e14b162aa0ce40f11920ec94bfc12da29e5d0",
"vendor/web-discovery-project": "https://github.com/brave/web-discovery-project@332821fc8800436d20608420bb87b90d231d9753",
"vendor/web-discovery-project": "https://github.com/brave/web-discovery-project@943ba3c98734328f62b5e670bc2e1fd97eef031d",
"third_party/ethash/src": "https://github.com/chfast/ethash.git@e4a15c3d76dc09392c7efd3e30d84ee3b871e9ce",
"third_party/bitcoin-core/src": "https://github.com/bitcoin/bitcoin.git@95ea54ba089610019a74c1176a2c7c0dba144b1c",
"third_party/argon2/src": "https://github.com/P-H-C/phc-winner-argon2.git@62358ba2123abd17fccf2a108a301d4b52c01a7c",
Expand Down
39 changes: 38 additions & 1 deletion components/webpack/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,44 @@ module.exports = async function (env, argv) {
{
test: /\.(ttf|eot|ico|svg|png|jpg|jpeg|gif)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file-loader'
}]
},
// In order to fix a memory leak in WDP we introduced the 'linkedom'
// depencendy: https://github.com/brave/web-discovery-project/pull/197
//
// One of the transitive dependencies of 'linkedom' relies on a
// specific export syntax that is not supported by Webpack v4:
//
// > ERROR in ./vendor/web-discovery-project/node_modules/htmlparser2/lib/esm/index.js 59:9
// > Module parse failed: Unexpected token (59:9)
// > You may need an appropriate loader to handle this file type,
// > currently no loaders are configured to process this file. See
// > https://webpack.js.org/concepts#loaders
// | return getFeed(parseDOM(feed, options));
// | }
// > export * as DomUtils from "domutils";
//
// Updating to Webpack 5 was not possible at this point given the
// config to be updated and multiple dependencies and commands that
// would break, so instead we added 'babel-loader' specifically for
// this problematic file, which allows to support the export syntax.
{
test: (input) => {
remusao marked this conversation as resolved.
Show resolved Hide resolved
// Handle both Windows and Linux/Mac paths formats
return (
input.endsWith('/htmlparser2/lib/esm/index.js') ||
input.endsWith('\\htmlparser2\\lib\\esm\\index.js')
);
},
use: [
{
loader: 'babel-loader', // This should be the last loader of course
options: {
plugins: ['@babel/plugin-proposal-export-namespace-from'],
},
},
],
},
]
},
node: {
fs: 'empty'
Expand Down
83 changes: 59 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@
},
"devDependencies": {
"@babel/core": "7.16.0",
"@babel/plugin-proposal-export-namespace-from": "7.16.0",
"@storybook/addon-essentials": "6.4.13",
"@storybook/addon-knobs": "6.4.0",
"@storybook/addons": "6.4.13",
Expand Down