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

refactor!: replace module.exports with ES module export #1674

Merged
merged 7 commits into from May 12, 2020

Conversation

sodatea
Copy link
Member

@sodatea sodatea commented May 9, 2020

This change fixes the emitted TypeScript type definitions

Closes #1667.

@sodatea sodatea marked this pull request as ready for review May 11, 2020 13:08
@sodatea sodatea requested a review from yyx990803 May 11, 2020 13:11
@@ -38,7 +40,10 @@ export interface VueLoaderOptions {

let errorEmitted = false

const loader: webpack.loader.Loader = function(source: string) {
export default function loader(
Copy link
Member

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?

Copy link
Member Author

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.

test/utils.ts Outdated Show resolved Hide resolved
@sodatea sodatea merged commit 0b35f5c into vuejs:next May 12, 2020
@sodatea sodatea deleted the fix-ts-epxorts branch May 12, 2020 08:41
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

Successfully merging this pull request may close these issues.

None yet

2 participants