Skip to content

isSelfAccepting of undefined in Vite 2.9.7 SSR #7992

@saurabhdaware

Description

@saurabhdaware

Describe the bug

After 2.9.7, Vite started throwing isSelfAccepting of undefined error.

It seems to happen specifically in the case where we pass inlined css through vite.transformIndexHtml.

Also, before facing this issue, I am also facing #6859 (comment) (which I fixed by adding a random file name to "main" property of package.json (seem hacky))

So this issue could be a side-effect of that issue.

Reproduction

https://stackblitz.com/edit/github-12zodn-gvvydc?file=server.js&terminal=dev

System Info

System:
    OS: macOS 11.4
    CPU: (8) x64 Apple M1
    Memory: 26.97 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.5.0 - ~/.nvm/versions/node/v16.5.0/bin/node
    Yarn: 1.22.15 - ~/.yarn/bin/yarn
    npm: 7.19.1 - ~/.nvm/versions/node/v16.5.0/bin/npm
  Browsers:
    Brave Browser: 97.1.34.80
    Chrome: 100.0.4896.127
    Safari: 14.1.1

Used Package Manager

npm

Logs

TypeError: Cannot set properties of undefined (setting 'isSelfAccepting')
    at TransformContext.transform (/home/projects/github-12zodn-gvvydc/node_modules/vite/dist/node/chunks/dep-88bd5805.js:56775:48)
    at async Object.transform (/home/projects/github-12zodn-gvvydc/node_modules/vite/dist/node/chunks/dep-88bd5805.js:38911:30)
    at async eval (/home/projects/github-12zodn-gvvydc/node_modules/vite/dist/node/chunks/dep-88bd5805.js:56245:24)
    at async Promise.all (index 0)
    at async devHtmlHook (/home/projects/github-12zodn-gvvydc/node_modules/vite/dist/node/chunks/dep-88bd5805.js:56240:5)
    at async applyHtmlTransforms (/home/projects/github-12zodn-gvvydc/node_modules/vite/dist/node/chunks/dep-88bd5805.js:29471:21)
    at async eval (/home/projects/github-12zodn-gvvydc/server.js:46:18) {
  plugin: 'vite:import-analysis',
  id: '/home/projects/github-12zodn-gvvydc?html-proxy&0.css',
  pluginCode: '\n      body {\n        background-color: red;\n      }\n    '
}

Validations

Metadata

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