Closed hckhanh closed 4 years ago
still seeing the error after npm i --save-dev --save-exact airbnb-js-shims@2.2.0
explicit. This work around is for current version of SB? Or do I need to rollback?
my current SB dependencies are,
"@storybook/addon-actions": "^5.0.11",
"@storybook/addon-links": "^5.0.11",
"@storybook/addons": "^5.0.11",
"@storybook/react": "^5.0.11",
"airbnb-js-shims": "2.2.0",
"storybook-react-router": "^1.0.5",
@TFisch I had to add
"resolutions": {
"airbnb-js-shims": "2.2.0",
"es-get-iterator": "1.0.1",
"is-map": "1.0.1",
"is-set": "1.0.0"
},
to package.json
and regenerate the lockfile
~~Update:
This doesn't appear to be a great workaround. Storybook builds now, but creates a very long list of warnings with imports that cannot be found.
I get the Storybook UI now up and running, but none of my stories are present...~~
There was a weird exclusion rule for node_modules
left from the Gatsby starter. Everything is working now
@sahariko neither package is faulty. Top level return is valid in node modules; it’s probably webpack not being configured properly.
@thuringia thanks for the suggestion but I'm using npm so resolutions seems to not be accessible.
@ljharb Regardless, I think it's a good idea to provide support for consumers that use webpack, which is arguably a whole lot.
That is quite true, but webpack v4.31+ supports top level return as far as i am aware.
@TFisch did you try to add is-set
and is-map
as dependencies and dedupe? That should create the same effect using npm
If someone can identify the exact thing that’s failing to properly parse is-map and is-set, i could easily be convinced to alter those packages to not rely on that feature of CJS. Has anyone done that?
Are you inherently opposed to this fix - https://github.com/inspect-js/is-map/pull/5? It also cleans up the module a little bit.
I’ll review it when i get to a computer, but I’m philosophically opposed to any change forced on my module by broken tools, at least not without understanding exactly which tools are broken so i can pursue fixing them.
@thuringia
so adding
"es-get-iterator": "1.0.1", "is-map": "1.0.1", "is-set": "1.0.0"
as dependencies, then "airbnb-js-shims": "2.2.0"
, as a dev-depend? I've done that followed by npm dedupe and I'm still seeing the error.
Update: Im now receiving the same error, but its pointing to the modules of the dependency instead of the project.
Previous error path: myProject/node_modules/is-map/index.js
New error path: myProject/node_modules/es-get-iterator/node_modules/is-map/index.js
Did I do something silly?
That is quite true, but webpack v4.31+ supports top level return as far as i am aware.
It also brings some bugs, we had to lock to 4.28
due to this issue with dynamic-loader: https://github.com/webpack/webpack/issues/8656.
Maybe it has been solved since but it was a real blocker for a Webpack update
It seems that some other package may import es-get-iterator
, my own workaround does not work this good :/ what's your versions of Webpack for those having solved the issue or still facing it?
Maybe try npm i --save-dev --save-exact airbnb-js-shims@2.2.0 promise.allsettled@1.0.1
Basically subdependencies don't necessarily lock version so we have to identify all culprits for this to work, so we have 0 dependency on is-map
, is-set
.
The real solution is probably either including "faulty" modules in the Babel build, or updating Webpack to support those modules. Basically the is-set
, is-map
modules are "right" but many build system may lag behind for some reason (regression in new versions of Webpack etc.)
Edit: tested, working for me
I got the workaround working following what @eric-burel and @thuringia mentioned. Thanks, guys!
What I've done is installing the conflicting libs to a previous version.
yarn add is-set@1.0.0 is-map@1.0.1 es-get-iterator@1.0.1 airbnb-js-shims@2.2.0
Once installed, then added the resolutions
property in package.json
.
"resolutions": {
"airbnb-js-shims": "2.2.0",
"es-get-iterator": "1.0.1",
"is-map": "1.0.1",
"is-set": "1.0.0"
},
For those using npm
, perhaps you can check npm-force-resolutions.
Essentially, the issue is caused both by webpack being broken prior to v4.31, and babel/CRA not enabling allowTopLevelReturn
by default, and it's worsened by the (highly unsafe) behavior of transpiling third party code.
I'll have a change published for is-map and is-set soon which should address this.
v2.0.1 of both is-map and is-set have been released; this can be closed.
Thanks so much for the fix @ljharb!
It sounds like there's something fishy going on in the ecosystem, and we'll do our best to sort this out on the Storybook side too.
In the meantime, hopefully this unbreaks a lot of people! 🙌
With Jenkins build throwing the same error.
When I try to update to
v5.3.0-beta.23
I get this error when building the project