downshift: [6.1.4] TS compile problem - broken storybook build

  • downshift version: 6.1.4
  • node version: v14.16.1
  • npm version: 6.14.12

Relevant code or config

Just a regular Storybook setup.


    "@storybook/addon-actions": "^6.2.9",
    "@storybook/addon-controls": "^6.2.9",
    "@storybook/addon-docs": "^6.2.9",
    "@storybook/addon-info": "5.3.21",
    "@storybook/addon-postcss": "2.0.0",
    "@storybook/addon-viewport": "6.2.9",
    "@storybook/addons": "6.2.9",
    "@storybook/builder-webpack5": "6.2.9",
    "@storybook/preset-scss": "1.0.3",
    "@storybook/react": "6.2.9",

What you did:

Storybook build broke.

What happened:

92% sealing asset processing TerserPluginERR! => Failed to build the manager
ERR! ./node_modules/downshift/dist/downshift.esm.js 2268:25
ERR! Module parse failed: Unexpected token (2268:25)
ERR! You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
ERR! |                 .startsWith(lowerCasedKeysSoFar)) {
ERR! |             const element = getItemNodeFromIndex(offsetIndex);
ERR! >             if (!element?.hasAttribute('disabled')) {
ERR! |                 return offsetIndex;
ERR! |             }
ERR!  @ ./node_modules/@storybook/react/node_modules/@storybook/ui/dist/esm/components/sidebar/Search.js 43:0-34 258:11-20 269:11-20 275:11-20 294:11-20 295:11-20 335:11-20 346:42-51
ERR!  @ ./node_modules/@storybook/react/node_modules/@storybook/ui/dist/esm/components/sidebar/Sidebar.js
ERR!  @ ./node_modules/@storybook/react/node_modules/@storybook/ui/dist/esm/containers/sidebar.js
ERR!  @ ./node_modules/@storybook/react/node_modules/@storybook/ui/dist/esm/app.js
ERR!  @ ./node_modules/@storybook/react/node_modules/@storybook/ui/dist/esm/index.js
ERR!  @ ./node_modules/@storybook/react/node_modules/@storybook/core-client/dist/esm/manager/index.js
ERR!  @ multi ./node_modules/@storybook/react/node_modules/@storybook/core-server/dist/cjs/globals/polyfills.js ./node_modules/@storybook/react/node_modules/@storybook/core-client/dist/esm/manager/index.js @storybook/addon-viewport/register @storybook/addon-controls/register @storybook/addon-actions/register ./.storybook/generated-refs.js

Reproduction repository:

Unable to provide at this time.

Problem description:

ERR! >             if (!element?.hasAttribute('disabled')) {

What looks to be a minor version bump suddenly swapped TS compile target to es2020.

v6.1.3...v6.1.4#diff-b55cdbef49

Suggested solution:

Probably target shouldn’t be es2020? Unless I’m missing something.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 6
  • Comments: 19

Most upvoted comments

Let me know how it works with 6.1.5. Should be out in a jiffy.

Is there any way to test this in the future? I don’t want this to bite us again.

Thanks for your patience and help everyone, sorry for the issue! I am going to refactor Downshift with TS in preparation for other features, and the PR with the issue was the one with the setup part (lint, rollup, tsconfig, etc.)

Is there any way to test this in the future? I don’t want this to bite us again.

Not straight forward I guess. Test having a babel compiler setup with minimum browser support on js file which is importing downshift as a node module should fix it.

Thanks. Will 6.1.5 be released now?

React 17 version bump has been eliminated already, rolled back - no need to worry about that guys!

@silviuaavram 6.1.5-alpha.0 works. My assumption was correct. Can be published - Thanks!

@victordcq @storybook/ui depends on downshift, if you simply add "downshift": 6.1.3" to your package.json, it won’t help you. Underneath @storybook/ui will still install 6.1.4 version of downshift. NPM won’t update transitive dependencies for you. Run npm ls downshift to see for yourself, I suspect that’s what’s happening on your end.

You need to use either:

a) yarn with yarn.lock b) npm with shrinkwrap c) npm with package.lock d) perhaps a tool like https://github.com/rogeriochaves/npm-force-resolutions

Edit: once 6.1.5 is published, none of the above should be necessary for anyone. @storybook/ui should automatically pick up on the latest release for downshift and things will just work.

Happy coding everyone!

Thanks for confirming it!

Can you remove your node modules, cache clean, then try 6.1.5-alpha.0 again please? Just to be sure.

Ah seems we were making the same bug report at the same time xd