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

fix(bit-ignore): support "require" syntax #6980

Merged
merged 4 commits into from
Jan 30, 2023
Merged

Conversation

davidfirst
Copy link
Member

No description provided.

@davidfirst davidfirst enabled auto-merge (squash) January 30, 2023 22:26
@davidfirst davidfirst merged commit 52297f0 into master Jan 30, 2023
@davidfirst davidfirst deleted the bit-ignore-require branch January 30, 2023 22:27
@evelant
Copy link

evelant commented Jan 30, 2023

@davidfirst I've tried this out and it seems to work except for an error being logged in the file where I'm using // @bit-no-check. Bit status emits:

       error found while parsing the file (edit the file and fix the parsing error):
          src/static/ImageMapRequire.ts -> Cannot read properties of undefined (reading 'importSpecifiers')

This didn't happen prior to this patch.

@davidfirst
Copy link
Member Author

@evelant , any chance to get the content of this file so I could try reproducing it?

@evelant
Copy link

evelant commented Jan 31, 2023

@davidfirst the issue is here

const addImportSpecifier = (dependency, importSpecifier) => {
if (dependencies[dependency].importSpecifiers) {
dependencies[dependency].importSpecifiers.push(importSpecifier);
} else {
dependencies[dependency].importSpecifiers = [importSpecifier];
}
};

dependencies[dependency] is undefined so you can't access importSpecifiers. It seems to work fine with an if around it like

  const addImportSpecifier = (dependency, importSpecifier) => {
    if (dependencies[dependency]) {
      if (dependencies[dependency].importSpecifiers) {
        dependencies[dependency].importSpecifiers.push(importSpecifier);
      } else {
        dependencies[dependency].importSpecifiers = [importSpecifier];
      }
    }
  };

@davidfirst
Copy link
Member Author

Thanks. Fixed in #6988.

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

Successfully merging this pull request may close these issues.

3 participants