-
Notifications
You must be signed in to change notification settings - Fork 293
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
Running a file that requires lighthouse breaks #290
Comments
Thanks for reporting. This is due to the code: 'use strict';
const fs = require('fs');
const REPORT_TEMPLATE = fs.readFileSync(__dirname + '/report-template.html', 'utf8');
const REPORT_JAVASCRIPT = [
fs.readFileSync(__dirname + '/renderer/util.js', 'utf8'),
fs.readFileSync(__dirname + '/renderer/dom.js', 'utf8'),
// COMPAT: Remove when Microsoft Edge supports <details>/<summary>
// https://developer.microsoft.com/en-us/microsoft-edge/platform/status/detailssummary/?q=details
fs.readFileSync(require.resolve('details-element-polyfill'), 'utf8'),
fs.readFileSync(__dirname + '/renderer/details-renderer.js', 'utf8'),
fs.readFileSync(__dirname + '/renderer/crc-details-renderer.js', 'utf8'),
fs.readFileSync(__dirname + '/../../lib/file-namer.js', 'utf8'),
fs.readFileSync(__dirname + '/renderer/logger.js', 'utf8'),
fs.readFileSync(__dirname + '/renderer/report-ui-features.js', 'utf8'),
fs.readFileSync(__dirname + '/renderer/category-renderer.js', 'utf8'),
fs.readFileSync(__dirname + '/renderer/performance-category-renderer.js', 'utf8'),
fs.readFileSync(__dirname + '/renderer/pwa-category-renderer.js', 'utf8'),
fs.readFileSync(__dirname + '/renderer/report-renderer.js', 'utf8'),
].join(';\n');
const REPORT_CSS = fs.readFileSync(__dirname + '/report-styles.css', 'utf8');
const REPORT_TEMPLATES = fs.readFileSync(__dirname + '/templates.html', 'utf8');
module.exports = {
REPORT_TEMPLATE,
REPORT_TEMPLATES,
REPORT_JAVASCRIPT,
REPORT_CSS,
}; where This is effectively a duplicate of #41, so I'm marking as such and closing. |
@rlindskog — Did you ever find a way to work around this? |
Reopening as I think there is a way we could support this case specifically. |
@danoc I switched to AWS, native node, and @serverless-chrome/lambda temporarily. |
Hi! I've made a codebase to help debug the efforts to get Lighthouse working with I also tested out
Haven't been able to dig in further. |
Thanks @danoc for the clear replication on this. I'm looking into it. |
Ok, Lighthouse support is effectively pending this asset emission feature then - vercel/webpack-asset-relocator-loader#36. Will keep this issue open to track the overall Lighthouse support and integration test. |
Looks like @nkzawa was able to get it to work with Now here: https://github.com/zeit/integrations/tree/master/lighthouse Can't tell if it's using |
@danoc Unfortunately, it's not btw I just made |
The remaining issue on Lighthouse seems to be the following code: static requireGathererFromPath(path, options, coreAuditList, configDir) {
const coreGatherer = coreAuditList.find(a => a === `${path}.js`);
let requirePath = `../gather/gatherers/${path}`;
if (!coreGatherer) {
// Otherwise, attempt to find it elsewhere. This throws if not found.
requirePath = Config.resolveModule(path, configDir, 'gatherer');
}
const GathererClass = /** @type {GathererConstructor} */ (require(requirePath));
return {
instance: new GathererClass(),
implementation: GathererClass,
path,
options: options || {},
};
} where the requirePath is effectively a dynamic wildcard value. With vercel/webpack-asset-relocator-loader#39 merged we will support wildcard requires, but the above support can only be completed when we have support for dynamic wildcard passing through the analysis. I've created a tracking issue for this in vercel/webpack-asset-relocator-loader#40. |
The problem
I'm attempting to run lighthouse with the
@now/node
builder, and I am running into a problem. Here is the src and logs of the lambda. I believe below is the simplest way to replicate the bug.The code
The command
ncc run test.js
The module resolution warnings
The error
spectrum reference
The text was updated successfully, but these errors were encountered: