storybookjs / addon-styling

A base addon for configuring popular styling tools
MIT License
44 stars 10 forks source link

[Bug] On 2.0.2-next.4 the addon should be a ES module #91

Closed jqpe closed 1 year ago

jqpe commented 1 year ago

Describe the bug

On the next version of addon-styling starting the addon results in catched errors. Funnily enough, these don't have any effect on the functionality afaik.

Steps to reproduce the behavior

  1. Install @storybook/addon-styling@2.0.2-next.4
  2. Run Storybook in development mode
  3. Get bunch of errors

Screenshots and/or logs

WARN   Failed to load preset: {...}
export * from "./dist/preset";
^^^^^^

SyntaxError: Unexpected token 'export'
...
    at Module.require (node:internal/modules/cjs/loader:1127:19)
    at require (node:internal/modules/helpers:112:18)
WARN   Failed to load preset: {...} 
export * from "./dist/preset";
^^^^^^

SyntaxError: Unexpected token 'export'
...
    at Module._load (node:internal/modules/cjs/loader:942:12)
    at Module.require (node:internal/modules/cjs/loader:1127:19)
    at require (node:internal/modules/helpers:112:18)
info => Serving static files from ././.storybook/static at /

Environment

Additional context

This patch made it work without errors:

--- a/package.json
+++ b/package.json
@@ -1,6 +1,7 @@
 {
   "name": "@storybook/addon-styling",
   "version": "2.0.2-next.4",
+  "type": "module",
   "description": "A base addon for configuring popular styling tools",
   "keywords": [
     "style",
ShaunEvening commented 1 year ago

Hey @jqpe

addon-styling has been deprecated in favour of @storybook/addon-styling-webpack. This is effectively the GA of v2