Storybook: build-storybook fails with 'Cannot set property inList' under Babel 7.6

Created on 6 Nov 2019  路  7Comments  路  Source: storybookjs/storybook

Describe the bug

Trying to run build-storybook under webpack 4.41 and babel 7.6 fails with the following:

csvanefalk@SEGOTA0184 ~/I/pros-customer-portal-ui-components> build-storybook 
info @storybook/react v5.2.5
info 
info clean outputDir..
info => Copying prebuild dll's..
info => Building manager..
info => Loading manager config..
info => Loading presets
info => Loading custom addons config.
info => Compiling manager..
ERR! => Failed to build the manager
ERR! ./addons/jsx/jsx-panel.js
ERR! Module build failed (from ./node_modules/babel-loader/lib/index.js):
ERR! TypeError: /Users/csvanefalk/IdeaProjects/pros-customer-portal-ui-components/addons/jsx/jsx-panel.js: Cannot set property inList of [object Object] which has only a getter
ERR!     at PluginPass.exit (/Users/csvanefalk/IdeaProjects/pros-customer-portal-ui-components/node_modules/babel-plugin-minify-simplify/lib/index.js:549:40)
ERR!     at newFn (/Users/csvanefalk/IdeaProjects/pros-customer-portal-ui-components/node_modules/@babel/traverse/lib/visitors.js:179:21)
ERR!     at NodePath._call (/Users/csvanefalk/IdeaProjects/pros-customer-portal-ui-components/node_modules/@babel/traverse/lib/path/context.js:55:20)
ERR!     at NodePath.call (/Users/csvanefalk/IdeaProjects/pros-customer-portal-ui-components/node_modules/@babel/traverse/lib/path/context.js:42:17)
ERR!     at NodePath.visit (/Users/csvanefalk/IdeaProjects/pros-customer-portal-ui-components/node_modules/@babel/traverse/lib/path/context.js:99:8)
ERR!     at TraversalContext.visitQueue (/Users/csvanefalk/IdeaProjects/pros-customer-portal-ui-components/node_modules/@babel/traverse/lib/context.js:112:16)
ERR!     at TraversalContext.visitSingle (/Users/csvanefalk/IdeaProjects/pros-customer-portal-ui-components/node_modules/@babel/traverse/lib/context.js:84:19)
ERR!     at TraversalContext.visit (/Users/csvanefalk/IdeaProjects/pros-customer-portal-ui-components/node_modules/@babel/traverse/lib/context.js:140:19)
ERR!     at Function.traverse.node (/Users/csvanefalk/IdeaProjects/pros-customer-portal-ui-components/node_modules/@babel/traverse/lib/index.js:84:17)
ERR!     at NodePath.visit (/Users/csvanefalk/IdeaProjects/pros-customer-portal-ui-components/node_modules/@babel/traverse/lib/path/context.js:97:18)
ERR!     at TraversalContext.visitQueue (/Users/csvanefalk/IdeaProjects/pros-customer-portal-ui-components/node_modules/@babel/traverse/lib/context.js:112:16)
ERR!     at TraversalContext.visitMultiple (/Users/csvanefalk/IdeaProjects/pros-customer-portal-ui-components/node_modules/@babel/traverse/lib/context.js:79:17)
ERR!     at TraversalContext.visit (/Users/csvanefalk/IdeaProjects/pros-customer-portal-ui-components/node_modules/@babel/traverse/lib/context.js:138:19)
ERR!     at Function.traverse.node (/Users/csvanefalk/IdeaProjects/pros-customer-portal-ui-components/node_modules/@babel/traverse/lib/index.js:84:17)
ERR!     at NodePath.visit (/Users/csvanefalk/IdeaProjects/pros-customer-portal-ui-components/node_modules/@babel/traverse/lib/path/context.js:97:18)
ERR!     at TraversalContext.visitQueue (/Users/csvanefalk/IdeaProjects/pros-customer-portal-ui-components/node_modules/@babel/traverse/lib/context.js:112:16)
ERR!  @ ./addons/jsx/register.js 1:193-215
ERR!  @ ./.storybook/addons.js
ERR!  @ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./.storybook/addons.js ./node_modules/@storybook/core/dist/client/manager/index.js

To Reproduce
Steps to reproduce the behavior:
Make sure you have a clean local install, run `build-storybook

Expected behavior
Build should pass

Additional context

This exact build has worked fine up until approximately yesterday. The only major external change I have seen in that period is Babel releasing version 7.6, but it is difficult to find if this is failing due to that alone.

babel / webpack bug compatibility with other tools has workaround

Most helpful comment

Thank you @shilman! npm i -D @babel/[email protected] fixes it for me.

All 7 comments

The problem is actually in the babel-plugin-minify-simplify plugin, which broke under Babel 7.6: https://github.com/babel/minify/issues/967

I'm getting this same issue, on @storybook/angular 5.3.0-alpha.40. I haven't check our React or HTML SBs yet.

"devDependencies": {
    "@angular-devkit/build-angular": "~0.802.2",
    "@angular-devkit/build-ng-packagr": "~0.802.2",
    "@angular/cli": "~8.2.2",
    "@angular/compiler-cli": "~8.2.0",
    "@angular/language-service": "~8.2.0",
    "@compodoc/compodoc": "^1.1.11",
    "@storybook/addon-a11y": "^5.3.0-alpha.40",
    "@storybook/addon-actions": "^5.3.0-alpha.40",
    "@storybook/addon-docs": "^5.3.0-alpha.40",
    "@storybook/addon-knobs": "^5.3.0-alpha.40",
    "@storybook/addons": "^5.3.0-alpha.40",
    "@storybook/angular": "^5.3.0-alpha.40",
    "@storybook/preset-scss": "^1.0.2",
    "@storybook/theming": "^5.3.0-alpha.40",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "babel-loader": "^8.0.6",
    "codelyzer": "^5.0.0",
    "css-loader": "^3.1.0",
    "eslint": "^6.5.1",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "ng-packagr": "^5.3.0",
    "node-sass": "^4.12.0",
    "protractor": "~5.4.0",
    "sass-loader": "^7.1.0",
    "style-loader": "^0.23.1",
    "ts-node": "~7.0.0",
    "tsickle": "^0.36.0",
    "tslint": "~5.15.0",
    "typescript": "~3.5.3"
  }

Please try this workaround from @aaronbarker: https://github.com/storybookjs/storybook/issues/8744#issuecomment-550502621

Thank you @shilman! npm i -D @babel/[email protected] fixes it for me.

I think y'all mean 7.7, no?

doesnt seem to work when npm i -D @babel/[email protected]. :(

Was this page helpful?
0 / 5 - 0 ratings