0

I made my own style guide using react-styleguidist and typescript. Now after building the node package (private) and importing (npm install) it into my other project (where I want to use my style guide components) I am not able to get intellij suggestions to work.

My folder structure is (some files are omitted):

My-library/
   package.json
   README.md
   lib/
      components/
         Alert/
            Alert.d.ts
            Alert.d.ts
            index.d.ts
            index.js
         Other_Components/
       css/
       fonts/
       icons/
       index.d.ts
       index.js
       styled-components.d.ts
       styled-components.js

I did already check if my node_modules folder of my project was marked as library root (which it is) and I also checked if my package was showing up as not excluded.

My own style guide library works fine, I can use my components and type checking works as well.

I have been looking online for a good guide of how to build/package your project so that these IDE(suggestions/autocomplete) functions work correctly.

When I used the ant design(https://ant.design/) library in intellij and typed <Bu intellij would suggest me <Button> Same goes for when using Material-ui and the extra @types/material-ui npm package

This is what I would like to achieve with my own npm package as well.

I have no clue if the problem is in my import/exports (default)/index files or in one of my config files (package.json, .babelrc or tsconfig.json, webpack.config.js)

1 Answers1

0

In Visual code this works, so it has to be a bug in Intellij.

It has to do with exporting my component with styled-components like this in my Button.tsx file:

export default styled(Button)`

This is the bug report I found on Jetbrains youtrack: https://youtrack.jetbrains.com/issue/WEB-33709