Skip to content

Commit

Permalink
force acorn
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhulce committed May 29, 2018
1 parent fff8ae1 commit d575303
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lighthouse-extension/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d575303

Please sign in to comment.