From 9c15792e18c5a6ecc8878c5ae348d9ea140aa9bc Mon Sep 17 00:00:00 2001 From: Patrick Hulce Date: Tue, 29 May 2018 14:45:22 -0700 Subject: [PATCH] force acorn --- lighthouse-extension/gulpfile.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lighthouse-extension/gulpfile.js b/lighthouse-extension/gulpfile.js index ace721e2526c..45782e5f47c9 100644 --- a/lighthouse-extension/gulpfile.js +++ b/lighthouse-extension/gulpfile.js @@ -22,9 +22,12 @@ const pkg = require('../package.json'); const distDir = 'dist'; // HACK: patch astw, see https://github.com/GoogleChrome/lighthouse/issues/5152 +const acornPath = require.resolve('acorn'); const ASTW_PATH = require.resolve('astw/index.js'); const astwOriginalContent = fs.readFileSync(ASTW_PATH, 'utf8'); -const astwPatchedContent = astwOriginalContent.replace(/ecmaVersion: .* 8,/, 'ecmaVersion: 2018,'); +const astwPatchedContent = astwOriginalContent + .replace(/ecmaVersion: .* 8,/, 'ecmaVersion: 2018,') + .replace(/require('acorn')/, `require("${acornPath}")`); fs.writeFileSync(ASTW_PATH, astwPatchedContent); const VERSION = pkg.version;