Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fixup: lazily load acorn
  • Loading branch information
guybedford committed Jul 15, 2021
commit b156244365bbd30d11cdf712a232f5d1b9926372
3 changes: 1 addition & 2 deletions lib/internal/modules/cjs/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ let debug = require('internal/util/debuglog').debuglog('module', (fn) => {
debug = fn;
});

const parser = require('internal/deps/acorn/acorn/dist/acorn').Parser;

// TODO: Use this set when resolving pkg#exports conditions in loader.js.
const cjsConditions = new SafeSet(['require', 'node', ...userConditions]);

Expand Down Expand Up @@ -189,6 +187,7 @@ function normalizeReferrerURL(referrer) {

// For error messages only - used to check if ESM syntax is in use.
function hasEsmSyntax(code) {
const parser = require('internal/deps/acorn/acorn/dist/acorn').Parser;
let root;
try {
root = parser.parse(code, { sourceType: 'module', ecmaVersion: 'latest' });
Expand Down