Skip to content

[3.1.0] this inside plugin hooks no loger points to the plugin object #10031

Closed as not planned
brillout/vite-plugin-mdx
#52
@csr632

Description

Describe the bug

In this PR that just published: https://github.com/vitejs/vite/pull/9634/files#r965058188
If plugin authors use this in their plugin hooks to refer to the plugin object, like this:
https://github.com/brillout/vite-plugin-mdx/blob/ee4a732f19bd8ee072dc5257b96c3012f2cd6d75/src/index.ts#L52

After upgrading to vite@3.1.0, we get error when running vite serve:

TypeError: Cannot set properties of undefined (setting 'transform')
    at configResolved (/.../vite-plugin-mdx/dist/index.js:47:28)

stackblitz demo: https://stackblitz.com/edit/vitejs-vite-8xpzra?file=package.json&terminal=dev

Previous version works: vite@3.0.9.

Reproduction

https://stackblitz.com/edit/vitejs-vite-8xpzra?file=package.json&terminal=dev

System Info

vite@3.1.0

Used Package Manager

npm

Logs

No response

Validations

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions