ampproject/rollup-plugin-closure-compiler

TypeError: baseVisitor[type] is not a function when encountering ChainExpression

icy0307 opened this issue · 1 comments

What's the issue?

TypeError: baseVisitor[type] is not a function when encountering ChainExpression

How do we reproduce the issue?

  1. Create a js file that contains Optional chaining
  2. and run rollup-plugin-closure-compiler

We'll likely need to know:

  1. Your Rollup configuration.
import pkg from '../package.json';
import typescript from '@rollup/plugin-typescript';
import compiler from '@ampproject/rollup-plugin-closure-compiler';
const externalPackages = [
    ...Object.keys(pkg.dependencies),
    ...Object.keys(pkg.peerDependencies),
];
function external(id) {
    return externalPackages.some(externalPackage => id.startsWith(externalPackage));
}
export default [{
    input: 'src/index.ts',
    output: [{
        format: 'esm',
        dir: 'lib',
        preserveModules: true,
        preserveModulesRoot: 'src',
    },
    ],
    external,
    plugins: [
        typescript(),
        compiler()
    ],
}];
  1. Error logs from your console when invoking Rollup with this plugin present.
[!] (plugin closure-compiler) TypeError: baseVisitor[type] is not a function
TypeError: baseVisitor[type] is not a function
    at c (/projects/sheet-formula-sdk/node_modules/@ampproject/rollup-plugin-closure-compiler/node_modules/acorn-walk/dist/walk.js:29:24)
    at Object.skipThrough (/projects/sheet-formula-sdk/node_modules/@ampproject/rollup-plugin-closure-compiler/node_modules/acorn-walk/dist/walk.js:186:39)
    at c (/projects/sheet-formula-sdk/node_modules/@ampproject/rollup-plugin-closure-compiler/node_modules/acorn-walk/dist/walk.js:29:24)
    at Object.base.BinaryExpression.base.LogicalExpression (/projects/sheet-formula-sdk/node_modules/@ampproject/rollup-plugin-closure-compiler/node_modules/acorn-walk/dist/walk.js:377:5)
    at c (/projects/sheet-formula-sdk/node_modules/@ampproject/rollup-plugin-closure-compiler/node_modules/acorn-walk/dist/walk.js:29:24)
    at Object.skipThrough (/projects/sheet-formula-sdk/node_modules/@ampproject/rollup-plugin-closure-compiler/node_modules/acorn-walk/dist/walk.js:186:39)
    at c (/projects/sheet-formula-sdk/node_modules/@ampproject/rollup-plugin-closure-compiler/node_modules/acorn-walk/dist/walk.js:29:24)
    at Object.base.IfStatement (/projects/sheet-formula-sdk/node_modules/@ampproject/rollup-plugin-closure-compiler/node_modules/acorn-walk/dist/walk.js:206:5)
    at c (/projects/sheet-formula-sdk/node_modules/@ampproject/rollup-plugin-closure-compiler/node_modules/acorn-walk/dist/walk.js:29:24)
    at Object.skipThrough (/projects/sheet-formula-sdk/node_modules/@ampproject/rollup-plugin-closure-compiler/node_modules/acorn-walk/dist/walk.js:186:39)

  1. Error logs when this plugin is removed from your Rollup configuration.

If this is a feature request you can use this section to point to a prototype/mockup that will help us understand the request.

Additional context

The newest acorn-walk fix this problem. Maybe considering using range instead of specific version in package json?

same