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

fix: Cannot read properties of undefined (reading 'ssr') #1654

Conversation

dylan-chong
Copy link

@dylan-chong dylan-chong commented Dec 18, 2023

Fixes this while running vite 4.x.x with 25.0.7 of the commonjs rollup plugin here

12:25:55 AM [vite] Internal server error: Cannot read properties of undefined (reading 'ssr')
  Plugin: commonjs
  File: /home/dylanchong/partly-development/partly-2/packages/libs/dbids/build/index.js
      at load (file:///home/dylanchong/partly-development/partly-2/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/vite/dist/node/chunks/dep-68d1a114.js:44006:78)
      at analyzeRequiredModule (/home/dylanchong/partly-development/partly-2/node_modules/.pnpm/@[email protected][email protected]/node_modules/@rollup/plugin-commonjs/dist/cjs/index.js:694:13)
      at /home/dylanchong/partly-development/partly-2/node_modules/.pnpm/@[email protected][email protected]/node_modules/@rollup/plugin-commonjs/dist/cjs/index.js:802:19
      at async Promise.all (index 1)
      at async /home/dylanchong/partly-development/partly-2/node_modules/.pnpm/@[email protected][email protected]/node_modules/@rollup/plugin-commonjs/dist/cjs/index.js:781:32
      at async rewriteRequireExpressionsAndGetImportBlock (/home/dylanchong/partly-development/partly-2/node_modules/.pnpm/@[email protected][email protected]/node_modules/@rollup/plugin-commonjs/dist/cjs/index.js:1358:28)
      at async transformCommonjs (/home/dylanchong/partly-development/partly-2/node_modules/.pnpm/@[email protected][email protected]/node_modules/@rollup/plugin-commonjs/dist/cjs/index.js:1932:23)
      at async Object.transform (file:///home/dylanchong/partly-development/partly-2/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/vite/dist/node/chunks/dep-68d1a114.js:44352:30)
      at async loadAndTransform (file:///home/dylanchong/partly-development/partly-2/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/vite/dist/node/chunks/dep-68d1a114.js:55026:29)

In vite's code, this is the line that fails due to this being undefined

        async load(options) {
            // We may not have added this to our module graph yet, so ensure it exists
            await moduleGraph?.ensureEntryFromUrl(unwrapId(options.id), this.ssr);

Rollup Plugin Name: {name}

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

If yes, then include "BREAKING CHANGES:" in the first commit message body, followed by a description of what is breaking.

List any relevant issue numbers:

Description

@shellscape
Copy link
Collaborator

Thanks for the PR. We'll need a regression test for this before we can merge, however. Please add a test when you have the chance to.

It also looks like your branch might be a good bit behind master. Please rebase as well.

@FANZHETWO
Copy link

Hey, boss, did you get this resolved? So did I

@shellscape
Copy link
Collaborator

Closing as abandoned.

@shellscape shellscape closed this Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants