Skip to content

Typescript breaking changes in minor version bump #5017

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

Closed
ajeffrey opened this issue Feb 27, 2017 · 4 comments
Closed

Typescript breaking changes in minor version bump #5017

ajeffrey opened this issue Feb 27, 2017 · 4 comments

Comments

@ajeffrey
Copy link

hey, I've just spent the past 5 hours hunting down an issue where running npm install caused my typescript-based build to fail at runtime with Vue.use is not a function. I just re-checked the typescript integration page and it seems that the build system has been intentionally broken for typescript in a minor version bump, meaning that npm's default caret version matcher moved me onto 2.2.0 and invisibly broke my build. I've had to look through every build-related package I run, reverting to previous versions to figure out what went wrong.

I really appreciate all the hard work you guys are putting into making Vue, but can you please try to avoid breaking published compatibility guidelines in minor version increments? I understand that you're wanting to move into ESM-based modules but simply updating the .d.ts files in line with this change would prevent breaking people's dependencies silently.

@yyx990803
Copy link
Member

yyx990803 commented Feb 27, 2017

Sorry, this was unintentional. We surely don't want to break your stuff on minor releases. The incompatibility is a result of the combination of TypeScript + webpack 2, which unfortunately was not covered in our typings tests because the tests didn't take the interaction with webpack 2 into account.

However, even if we changed the d.ts to use ES-style exports, it would still be a breaking change, because AFAIK ES-style exports can't be made to work with existing CommonJS imports (import Vue = require('vue')).

Since the change is already out there, we will likely take the opportunity to fully migrate to ES-based exports in all our typings (See #5016). That said, we do apologize for the unintended breaking changes.

P.S. the workaround for now is simply configure webpack to alias vue to use the CommonJS build (vue/dist/vue[.runtime].common.js).

Update: we now recommend using allowSyntheticDefaultImports with ES style imports. See updated TS setup docs for more details.

@ajeffrey
Copy link
Author

don't sweat it - it happens. I think changing the d.ts files would help, if only because the issue would become a compilation rather than a runtime error, and therefore provide a more relevant error message. As it was, I ended up looking through all my build modules (webpack, ts-loader, vue-loader etc) thinking that something had stopped performing esm-cjs interop.

Thanks for getting back to me though, and thanks for the hard work you put in making Vue really great.

@yyx990803
Copy link
Member

Update: we now recommend using allowSyntheticDefaultImports with ES style imports. See updated TS setup docs for more details.

@ajeffrey
Copy link
Author

great, thanks! I'll check it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants