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

core(stack-packs): simplify i18n filename lookup #13133

Merged
merged 1 commit into from Sep 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 1 addition & 13 deletions lighthouse-core/lib/stack-packs.js
Expand Up @@ -9,18 +9,6 @@ const log = require('lighthouse-logger');
const stackPacks = require('lighthouse-stack-packs');
const i18n = require('./i18n/i18n.js');

/**
* Resolve a module on web and node
* @param {string} module
*/
function resolve(module) {
if (!require.resolve) {
return `node_modules/${module}`;
}

return require.resolve(module);
}

/**
* Pairs consisting of a stack pack's ID and the set of stacks needed to be
* detected in a page to display that pack's advice.
Expand Down Expand Up @@ -87,7 +75,7 @@ function getStackPacks(pageStacks) {

// Create i18n handler to get translated strings.
const str_ = i18n.createMessageInstanceIdFn(
resolve(`lighthouse-stack-packs/packs/${matchedPack.id}`),
`node_modules/lighthouse-stack-packs/packs/${matchedPack.id}.js`,
matchedPack.UIStrings
);

Expand Down