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

import serialize-javascript report Cannot read properties of undefined (reading 'from') #8203

Closed
7 tasks done
GreenMashimaro opened this issue May 18, 2022 · 3 comments · Fixed by #8338
Closed
7 tasks done

Comments

@GreenMashimaro
Copy link

GreenMashimaro commented May 18, 2022

Describe the bug

Create a new project through vite scaffolding and then import package serialize-javascript.
An error will be reported.
image

Reproduction

Key code snippets:link
reproduce:online link

However, create a project using Vue CLI, and then import package serialize-javascript will run normally.
Normal vue2 demonstration project(F12 see console.log normal output):
Key code snippets:snippets

System Info

System:
    OS: macOS 12.2.1
    CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
    Memory: 38.52 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.10.0 - ~/.nvm/versions/node/v16.10.0/bin/node
    Yarn: 1.22.18 - ~/.nvm/versions/node/v16.10.0/bin/yarn
    npm: 7.24.0 - ~/.nvm/versions/node/v16.10.0/bin/npm
  Browsers:
    Chrome: 101.0.4951.64
    Safari: 15.3
  npmPackages:
    @vitejs/plugin-vue: ^2.3.3 => 2.3.3 
    vite: ^2.9.9 => 2.9.9

Used Package Manager

pnpm

Logs

No response

Validations

@GreenMashimaro GreenMashimaro changed the title vite import serialize-javascript report Cannot read properties of undefined (reading 'from') import serialize-javascript report Cannot read properties of undefined (reading 'from') May 18, 2022
@GreenMashimaro
Copy link
Author

GreenMashimaro commented May 18, 2022

So this is not vite's problem.
Because the dependency of buffer package is missing.
But I'm surprised that Vue CLI project works normally, while the project created by vite doesn't work properly.

I solve it in the following ways.

pnpm install buffer

@GreenMashimaro
Copy link
Author

GreenMashimaro commented May 19, 2022

For this problem, vite's tips are unfriendly from the beginning.
Normally, it should prompt that the buffer package is not found.

@sapphi-red
Copy link
Member

Related: #6493 (comment)

@github-actions github-actions bot locked and limited conversation to collaborators Jun 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants