-
Notifications
You must be signed in to change notification settings - Fork 915
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
refactor!: replace module.exports with ES module export #1674
Conversation
This change fixes the emitted TypeScript type definitions Closes vuejs#1667.
@@ -38,7 +40,10 @@ export interface VueLoaderOptions { | |||
|
|||
let errorEmitted = false | |||
|
|||
const loader: webpack.loader.Loader = function(source: string) { | |||
export default function loader( |
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 would require require('vue-loader').default
? Does webpack have built-in esModule default interop?
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.
Yeah, webpack uses loader-runner
to run loaders, and it supports .default
https://github.com/webpack/loader-runner/blob/master/lib/loadLoader.js#L26
Or we can provide another .cjs
entry if compatibility is a concern.
But I don't think it's necessary, as vue-loader
is only supposed to be called by webpack.
This change fixes the emitted TypeScript type definitions
Closes #1667.