New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
is-map: 'return' outside of function #9154
Comments
Upgrading from which version? What other packages do you have installed? Do you have a repro you can share? |
I will share my package.json for you now {
"name": "Demo",
"version": "0.1.0",
"private": true,
"dependencies": {
"@casl/ability": "^3.3.0",
"@casl/react": "^1.0.4",
"@material-ui/core": "^4.8.0",
"@material-ui/icons": "^4.5.1",
"@material-ui/lab": "^4.0.0-alpha.36",
"@reach/router": "^1.2.1",
"@sentry/browser": "^5.10.1",
"@types/jest": "24.0.23",
"@types/lodash.get": "4.4.6",
"@types/node": "12.12.17",
"@types/reach__router": "1.2.6",
"@types/react": "16.9.16",
"@types/react-dom": "16.9.4",
"@types/yup": "0.26.26",
"@xstate/react": "^0.8.1",
"axios": "^0.19.0",
"clsx": "^1.0.4",
"http-errors": "^1.7.3",
"immer": "^5.0.0",
"lodash.get": "^4.4.2",
"material-ui-dropzone": "^2.4.7",
"notistack": "^0.9.7",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-hook-form": "^3.29.2",
"react-scripts": "3.3.0",
"recharts": "^1.8.5",
"typescript": "3.7.3",
"use-immer": "^0.3.5",
"xstate": "^4.7.3",
"yup": "^0.27.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"storybook": "start-storybook -p 9009 -s public",
"build-storybook": "build-storybook -s public"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@babel/core": "^7.7.5",
"@storybook/addon-a11y": "^5.3.0-beta.23",
"@storybook/addon-actions": "^5.3.0-beta.23",
"@storybook/addon-backgrounds": "^5.3.0-beta.23",
"@storybook/addon-docs": "^5.3.0-beta.23",
"@storybook/addon-knobs": "^5.3.0-beta.23",
"@storybook/addon-links": "^5.3.0-beta.23",
"@storybook/addon-notes": "^5.3.0-beta.23",
"@storybook/addon-viewport": "^5.3.0-beta.23",
"@storybook/addons": "^5.3.0-beta.23",
"@storybook/preset-create-react-app": "^1.4.0",
"@storybook/react": "^5.3.0-beta.23",
"@typescript-eslint/eslint-plugin": "^2.10.0",
"@typescript-eslint/parser": "^2.10.0",
"babel-loader": "^8.0.6",
"eslint": "^6.7.2",
"eslint-config-google": "^0.14.0",
"eslint-config-prettier": "^6.7.0",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.17.0",
"husky": "^3.1.0",
"lint-staged": "^9.4.3",
"prettier": "^1.19.1"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.ts?(x)": [
"prettier --write",
"eslint --fix",
"git add"
]
}
}
|
Let me know anything you need! |
I don't remember the exact previous version, but I make sure that it must be |
using version |
It seems that the problem is babel-loader applied to |
And the error on I couldn't confirm the exact release version of the patch for this issue, but guessing from PR's date, it was 4.x. So we can't use storybook@3 anymore? 🤔 |
This appears to be due to storybookjs/presets#78 I'm going to pursue this issue there, but will leave this issue open until it's resolved, since I bet a lot of people will be looking for this. |
downgrade to |
@LaViro This is a problem with |
@shilman |
@pocka You don't need to downgrade at all though. Simply remove the preset and use 5.2 or 5.3-beta. You can see my test results here: storybookjs/presets#78 (comment) |
@shilman I can't see why downgrading works though. |
Fixed in |
@shilman These are my storybook dependencies: "@storybook/addon-actions": "^4.1.11", I'm not using the presets package but I've also started experiencing it today. |
@alonfixlerfiverr Ugh, sorry to hear that. Looking into it now. UPDATE: Here's what I've got.
|
@shilman we are still using webpack 3 therefore we can't upgrade at the moment, |
Hi, @shilman I am also now getting this error but my dependencies is like this:
Can someone please help. Thank you so much in advance. |
exactly same issue with "@storybook/preact": "5.2.1" |
@webdevelperify can you pin to "@storybook/react": "3.4.10" instead? without the '^' @shilman, seems that that's might be the reason that |
@LaViro thank you so much for your instruction. It works as suggested by you. I am very new in this space can you please point me to some article where it explains how to debug these kind of issues. I never get this part and stuck where to start. |
@webdevelperify you can check out this short documentation: https://docs.npmjs.com/about-semantic-versioning |
@LaViro Great tip on |
@eugenefm Not able to reproduce. Can you share your repo with me? |
@shilman nevermind it was actually different error, sorry about that, was jumping between issues trying to troubleshoot and mixed up this thread with another one. |
Explictely installing Edit: it was not enough, see #9154 (comment) The idea is that a call to |
However I have a lot of issues lately with all those ES6 updates and all, half my apps don't build when I rerun them, always due to sub-dependencies... even when using Webpack or Babel... |
@eric-burel you rock. @thuringia @n8sabes @sahariko please try @eric-burel 's workaround: upvote his comment if it's working for you & comment here if it doesn't. thanks! |
Opened PRs for both faulty packages: |
still seeing the error after
|
@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
|
@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 |
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 - inspect-js/is-map#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 Update: Im now receiving the same error, but its pointing to the modules of the dependency instead of the project. Previous error path: New error path: Did I do something silly? |
It also brings some bugs, we had to lock to Maybe it has been solved since but it was a real blocker for a Webpack update |
It seems that some other package may import |
Maybe try Basically subdependencies don't necessarily lock version so we have to identify all culprits for this to work, so we have 0 dependency on The real solution is probably either including "faulty" modules in the Babel build, or updating Webpack to support those modules. Basically the 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.
Once installed, then added the
For those using |
Closes #5. Closes #4. Closes #3. Closes inspect-js/node-deep-equal#78. Closes es-shims/Promise.allSettled#7. Closes airbnb/js-shims#12. Relates to inspect-js/is-set#4, inspect-js/is-set#5 Addresses storybookjs/storybook#9154.
Closes inspect-js#5. Closes inspect-js#4. Closes inspect-js#3. Closes inspect-js/node-deep-equal#78. Closes es-shims/Promise.allSettled#7. Closes airbnb/js-shims#12. Relates to inspect-js/is-map#3, inspect-js/is-map#4, inspect-js/is-map#5 Addresses storybookjs/storybook#9154.
Essentially, the issue is caused both by webpack being broken prior to v4.31, and babel/CRA not enabling 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! 🙌 |
Closes inspect-js/node-deep-equal#79. Closes inspect-js/node-deep-equal#78. Closes es-shims/Promise.allSettled#7. Closes airbnb/js-shims#12. Relates to: - inspect-js/is-map#5 - inspect-js/is-map#4 - inspect-js/is-map#3 - inspect-js/is-set#5 - inspect-js/is-set#4 - storybookjs/storybook#9154.
Closes inspect-js/node-deep-equal#79. Closes inspect-js/node-deep-equal#78. Closes es-shims/Promise.allSettled#7. Closes airbnb/js-shims#12. Relates to: - inspect-js/is-map#5 - inspect-js/is-map#4 - inspect-js/is-map#3 - inspect-js/is-set#5 - inspect-js/is-set#4 - storybookjs/storybook#9154.
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 projectThe text was updated successfully, but these errors were encountered: