Skip to content
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

Reintroduce support for Webpack 4 in Vue Apollo Composable #1220

Closed
HansCronau opened this issue Jul 8, 2021 · 4 comments
Closed

Reintroduce support for Webpack 4 in Vue Apollo Composable #1220

HansCronau opened this issue Jul 8, 2021 · 4 comments

Comments

@HansCronau
Copy link

HansCronau commented Jul 8, 2021

Description
@vue/apollo-composable 4.0.0-alpha.13 broke support for webpack 4 by using a nullish coalescing operator.
As discussed in issue #1217, webpack 4 uses acorn 6, while support for the nullish coalescing operator was only added in acorn 7.
Users of webpack 4 will now get the error: Module parse failed: Unexpected token (19:103).
Reintroducing support for webpack 4 would be especially useful for users who have abstracted away webpack.

Proposed solution
On issue #1217, @Akryum commented that he would probably lower the esbuild target to what acorn 6 understands.

Alternatives
Alternatives are upgrading to webpack 5 or freezing @vue/apollo-composable at 4.0.0-alpha.12.
I see that @tobiasdiez from issue #1217 has resorted to transpiling @vue/apollo-composable with babel.

Updating to webpack 5 is hard for those who use @vue/cli-service to abstract away webpack. Manually transpiling @vue/apollo-composable is also not ideal.
Since I believe the intention is to reintroduce support for webpack 4 within @vue/apollo-composable, I'm currently holding at 4.0.0-alpha.12.

@Akryum
Copy link
Member

Akryum commented Jul 8, 2021

Per the webpack team, transpiling dependencies is not a bad idea. Instead of going with the lower common denominator (IE) leading to shipping older and heavier code, it would probably better that the ecosystem goes towards the opposite = let the final 'user' decide what to transpile to which target - especially when the code being transpiled is fully valid standard JS.

@HansCronau
Copy link
Author

@Akryum, I completely agree. But am I correct in observing that in this case the lowest common denominator is acorn 6, used by webpack 4, installed by the Vue CLI for projects in Vue 2, which is still the current version of Vue?
Rather than using old and heavy code, I was under the impression that I was on the bleeding edge by using @vue/apollo-composable in my Vue 2 project. 😐

@Akryum
Copy link
Member

Akryum commented Jul 8, 2021

Yes, that's why I said I'll change the target accordingly.

@HansCronau
Copy link
Author

Cool. I probably mistakenly interpreted your comment as considering not going back.
Thanks for your work and quick responses!

Akryum added a commit that referenced this issue Jul 19, 2021
@Akryum Akryum closed this as completed Jul 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants