atomicojs / hooks

utility kit for use with Atomico

Home Page:https://atomico.gitbook.io/doc/atomico/atomico-hooks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Import issues within Storybook and others

efoken opened this issue · comments

I have issues when importing Atomico hooks, when using Webpack – i.e. within Storybook

Field 'browser' doesn't contain a valid alias configuration
      using description file: /Users/eike.foken/Code/ds/node_modules/@atomico/hooks/package.json (relative path: ./use-slot)
        no extension
          Field 'browser' doesn't contain a valid alias configuration
          /Users/eike.foken/Code/ds/node_modules/@atomico/hooks/use-slot doesn't exist
        .web.js
          Field 'browser' doesn't contain a valid alias configuration
      using description file: /Users/eike.foken/Code/ds/packages/html/package.json (relative path: ./node_modules/@atomico/hooks/use-slot)
        no extension
          Field 'browser' doesn't contain a valid alias configuration
          /Users/eike.foken/Code/ds/node_modules/@atomico/hooks/use-slot.js doesn't exist

I think this is somehow related: webpack/webpack#4674

Hi @efoken, sorry for the delay, the error happens for the version of webpack@4 that Storybook uses by default, this version is not compatible with package.json#exports, to solve this you must use the following line of code:

npx sb init --builder webpack5

https://storybook.js.org/blog/storybook-for-webpack-5/#webpack-5-support, I hope it is useful, by the way if you like you can share your experience using Atomico and Storybook to generate documentation about it