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

[BUG] babelify in transpiler assumes no ignored babel files #1469

Open
asos-tomp opened this issue Dec 11, 2024 · 0 comments
Open

[BUG] babelify in transpiler assumes no ignored babel files #1469

asos-tomp opened this issue Dec 11, 2024 · 0 comments
Labels

Comments

@asos-tomp
Copy link

Describe the bug

Could be same as #664...

The code here:

const options = babel.loadOptions ? babel.loadOptions({ filename }) : { plugins: [] }

...assumes, as per babel documentation:

...resulting in an options object where:

opts.plugins is a full list of Plugin instances.

However, if a file is ignored, the options are returned as null and the attempt to spread options.plugins:

plugins: [...extraPlugins, ...options.plugins]

... causes a failure:

Error:  TypeError: [BABEL]: Cannot read properties of null (reading 'plugins')

Perhaps we can alter the ternary to be:

var options = babel.loadOptions?.({ filename: filename }) ?? { plugins: [] };

See #804 that last touched this.

To Reproduce
Steps to reproduce the behavior:

  1. Set an ignored file in .babelignore or ignore in config
  2. Run danger

Expected behavior

File is ignored for babel transpilation, danger processes it without issue.

Your Environment

software version
danger.js 11.3.0
node 22.3.0
npm 10.9.2
Operating System macOS 14.7.1
@asos-tomp asos-tomp added the bug label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant