whitespace-se / storybook-addon-html

A Storybook addon that extracts and displays compiled syntax-highlighted HTML
Other
95 stars 44 forks source link

Published Package Missing Decorator Files #31

Closed alexlafroscia closed 3 years ago

alexlafroscia commented 3 years ago

I'm trying to upgrade to version 4.0.0 but am seeing this issue when trying to start Storybook

ERROR in ./node_modules/@whitespace/storybook-addon-html/react.js
Module not found: Error: Can't resolve './out/decorators/react' in '/Users/alafroscia/Code/mi/tailwind-config/node_modules/@whitespace/storybook-addon-html'
 @ ./node_modules/@whitespace/storybook-addon-html/react.js 1:17-50
 @ ./.storybook/preview.js
 @ ./.storybook/preview.js-generated-config-entry.js
 @ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/storybook-init-framework-entry.js ./node_modules/@storybook/addon-a11y/dist/a11yRunner.js-generated-other-entry.js ./node_modules/@storybook/addon-a11y/dist/a11yHighlight.js-generated-other-entry.js ./node_modules/@storybook/addon-backgrounds/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-backgrounds/dist/preset/addParameter.js-generated-other-entry.js ./node_modules/@whitespace/storybook-addon-html/out/preset/addDecorators.js-generated-other-entry.js ./.storybook/preview.js-generated-config-entry.js ./.storybook/generated-stories-entry.js (webpack)-hot-middleware/client.js?reload=true&quiet=false&noInfo=undefined
alexlafroscia commented 3 years ago

The out/decorators/react.js file that is re-exported from that module does not exist in the actual NPM package. These are the contents of the published module

.
├── README.md
├── html.js
├── index.js
├── node_modules
├── out
│   ├── Panel.js
│   ├── SyntaxHighlighter.js
│   ├── decorators
│   │   ├── index.js
│   │   └── withHTML.js
│   ├── index.js
│   ├── preset
│   │   ├── addDecorators.js
│   │   └── index.js
│   ├── register.js
│   └── shared.js
├── package.json
├── preset.js
├── react.js
└── register.js

4 directories, 16 files
alexlafroscia commented 3 years ago

It seems like the html.js at the top level references an out/decorators/html.js file that also does not exist

jeanfredrik commented 3 years ago

Ah yes, those should be removed. There’s no need to import the decorator now since there’s a preset. Just add it in .storybook/main.js:

module.exports = {
  // ...
  addons: [
    '@whitespace/storybook-addon-html',
    // ...
  ],
};

But I will remove the orphaned JS files

alexlafroscia commented 3 years ago

Ah, I still had an import of the /react file without realizing it! Thanks for the help; the new version is working for me now 💯