-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Fix SyntaxError: Illegal return statement #4
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a syntax error whatsoever; this is a node module and top level return is allowed in it.
What bundler are you using that breaks on valid node modules?
Babel doesn't allow top level return by default; if you use
Top level This is an example of the whole error stack when building storybook:
|
It's highly unsafe to transpile code you didn't author; is this perhaps because you're trying to process third party code as if it's an ESM Module, instead of a CJS Script? If so, that will break things as well by forcing strict mode. It's certainly something only allowed because of CJS's function wrapper, but it has always had the function wrapper and that's what makes it valid. |
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.
91a30a2
to
4f9eeee
Compare
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.
Faced with SyntaxError in this package, because some package in my project depend from this package.