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

'instrument' required, then optional? Resulting in TypeError: Cannot destructure property 'instrument' of 'options' as it is undefined. #460

Closed
DonBranson opened this issue Sep 7, 2021 · 0 comments

Comments

@DonBranson
Copy link

DonBranson commented Sep 7, 2021

This is for fbjs-scripts 3.0.0

const {instrument, config} = options;

.update(instrument ? 'instrument' : '')

I have a question about this code, since we're failing on const {instrument, config} = options; because instrument does not exist in options. However, are we not expecting instrument could be missing in .update(instrument ? 'instrument' : '')? If so, could it be optional when destructered from options? We've been looking for a workaround, but nothing works yet.

  return (src, file, configString, options) => {
    const {instrument, config} = options;
    const rootDir = config && config.rootDir;

    return crypto
      .createHash('md5')
      .update(globalCacheKey)
      .update('\0', 'utf8')
      .update(src)
      .update('\0', 'utf8')
      .update(rootDir ? path.relative(config.rootDir, file) : '')
      .update('\0', 'utf8')
      .update(instrument ? 'instrument' : '')
      .digest('hex');
  };
}
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

1 participant