Skip to content
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

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

Open
icy0307 opened this issue Mar 31, 2023 · 1 comment

Comments

@icy0307
Copy link

icy0307 commented Mar 31, 2023

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?

@icy0307 icy0307 changed the title TypeError: baseVisitor[type] is not a function when encounting ChainExpression TypeError: baseVisitor[type] is not a function when encountering ChainExpression Apr 3, 2023
@bsafwen
Copy link

bsafwen commented Feb 16, 2024

same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants