-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
How can I import 'antd' or any other lib ? #1278
Comments
The code on the screenshots is different and the error message may explain what's wrong. |
I'm having the same issue as @robertaird when trying to upgrade from v8.0.6 to v9.0.0. Any import statement in my example (jsx inside a markdown file) results in this error being rendered in the browser:
(here $importName is a placeholder for whatever I tried to import). There is also an error in the console whenever this happens, screenshot below with the full traceback: Note: His "double import" trick also works for me but I'm hoping not to need that, for obvious reasons :) |
Similar issue here with v9.0.0:
module.exports = {
moduleAliases: {
'@mycompany/react-components': path.resolve(__dirname, 'src/components')
}
};
Error: |
I tried tracking down what was happening (under the assumption that I was doing it wrong) but I didn't have much luck. By the time the example hits this file, none of the imported filepaths are present in the 'requireMap' object. It seems like Acorn is choking on the jsx the first time around, for some reason, causing the imports in the md files to be missed by webpack(?). |
Has anyone solve this problem? I'm also getting the error:
When I try to import other components into the markdown file. |
Confirmed. @robertaird 's super hack works. But as expressed, it is a bit 'harcore'. Any followup on this? It seems to be quite a recurrent problem. |
I have had success fixing this problem by deleting |
@timsnadden how can deleting the lock file can help solving the import issue? I am also investigating and we dowgraded to v8.0.6 our documentation because of that. Can somebody help me point to the commint that changed the behavior in react-styleguidist? I can't find what change between v8 and v9 |
/cc @sapegin 👍 I think timsnadden got the cause, I have a similar case, can we get your opinion about it? I think you have a clue for us. We will get the reason and the fix. |
Maybe try to upgrade Buble and Acorn, if the problem is related to one of them. Though there's a problem with Buble — bublejs/buble#171, the fix wasn't yet released. |
I have found a way without yarn: Add to your dev dependencies: + "acorn": "^6.0.2",
+ "acorn-jsx": "^5.0.0", Rerun |
Due to styleguidist/react-styleguidist#1278 , we had to set in dependencies acorn@6.0.2 and acorn-jsx@5.0.0 due to peer dependency issue with npm BREAKING CHANGE: CodeMirror context is unique per example, see https://github.com/styleguidist/react-styleguidist/releases/tag/v9.0.0 for more info BREAKING CHANGE: We do not need to list react-styleguidist in our dependency
it works for me,thanks |
For me, doing a full clean re-install helped. ie:
Seems like something in the dependencies is indeed the culprit here. |
I think this might be the same problem of |
@paibamboo fixing version solved the issue for the moment. And yes it's related with |
😴 This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week without any further activity. Consider opening a pull request if you still have this issue or want this feature. |
Fwiw, I tried the removal of packages and reinstall without success. The acorn tip did work though: |
If this doesn't work try |
for me solution was to add "resolutions": {
"acorn": "6.4.0"
} to package.json |
Version
9.0.0-beta4
Current behavior
To reproduce
Expected behavior
I can use antd Button in ButtonGroup
The text was updated successfully, but these errors were encountered: