Skip to content

[polaris-react] Storybook build fails on class based components with static properties #7117

@kyledurand

Description

@kyledurand

Issue summary

Seeing a bunch of these in terminal when running yarn dev in the polaris-react folder. Storybook or babel doesn't know how to transform static properties

This issue began after #6852 shipped. I think it's related to yarn.lockchanges in that PR

ModuleBuildError: Module build failed (from ../node_modules/babel-loader/lib/index.js):
SyntaxError: /Users/kyledurand/Shopify/polaris/polaris-react/src/utilities/unique-id/unique-id-factory.ts: Missing class properties transform.
  3 |
  4 | export class UniqueIdFactory {
> 5 |   private idGeneratorFactory: IdGeneratorFactory;
    |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  6 |
  7 |   private idGenerators: {[key: string]: IdGenerator} = {};
  8 |
    at File.buildCodeFrameError (/Users/kyledurand/Shopify/polaris/node_modules/@babel/core/lib/transformation/file/file.js:249:12)
    at NodePath.buildCodeFrameError (/Users/kyledurand/Shopify/polaris/node_modules/@babel/traverse/lib/path/index.js:143:21)
    at pushBody (/Users/kyledurand/Shopify/polaris/node_modules/@babel/plugin-transform-classes/lib/transformClass.js:143:20)
    at buildBody (/Users/kyledurand/Shopify/polaris/node_modules/@babel/plugin-transform-classes/lib/transformClass.js:117:5)
    at classTransformer (/Users/kyledurand/Shopify/polaris/node_modules/@babel/plugin-transform-classes/lib/transformClass.js:577:5)
    at transformClass (/Users/kyledurand/Shopify/polaris/node_modules/@babel/plugin-transform-classes/lib/transformClass.js:621:10)
    at PluginPass.ClassExpression (/Users/kyledurand/Shopify/polaris/node_modules/@babel/plugin-transform-classes/lib/index.js:67:54)
    at newFn (/Users/kyledurand/Shopify/polaris/node_modules/@babel/traverse/lib/visitors.js:177:21)
    at NodePath._call (/Users/kyledurand/Shopify/polaris/node_modules/@babel/traverse/lib/path/context.js:53:20)
    at NodePath.call (/Users/kyledurand/Shopify/polaris/node_modules/@babel/traverse/lib/path/context.js:40:17)
    at NodePath.visit (/Users/kyledurand/Shopify/polaris/node_modules/@babel/traverse/lib/path/context.js:100:31)
    at TraversalContext.visitQueue (/Users/kyledurand/Shopify/polaris/node_modules/@babel/traverse/lib/context.js:105:16)
    at TraversalContext.visitSingle (/Users/kyledurand/Shopify/polaris/node_modules/@babel/traverse/lib/context.js:79:19)
    at TraversalContext.visit (/Users/kyledurand/Shopify/polaris/node_modules/@babel/traverse/lib/context.js:133:19)
    at traverseNode (/Users/kyledurand/Shopify/polaris/node_modules/@babel/traverse/lib/traverse-node.js:24:17)
    at NodePath.visit (/Users/kyledurand/Shopify/polaris/node_modules/@babel/traverse/lib/path/context.js:107:52)
    at processResult (/Users/kyledurand/Shopify/polaris/node_modules/@storybook/builder-webpack5/node_modules/webpack/lib/NormalModule.js:758:19)
    at /Users/kyledurand/Shopify/polaris/node_modules/@storybook/builder-webpack5/node_modules/webpack/lib/NormalModule.js:860:5
    at /Users/kyledurand/Shopify/polaris/node_modules/loader-runner/lib/LoaderRunner.js:400:11
    at /Users/kyledurand/Shopify/polaris/node_modules/loader-runner/lib/LoaderRunner.js:252:18
    at context.callback (/Users/kyledurand/Shopify/polaris/node_modules/loader-runner/lib/LoaderRunner.js:124:13)
    at /Users/kyledurand/Shopify/polaris/node_modules/babel-loader/lib/index.js:59:103

Metadata

Metadata

Assignees

Labels

BugSomething is broken and not working as intended in the system.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions