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

@vitejs/plugin-vue build failed #5925

Closed
7 tasks done
sufuwang opened this issue Dec 2, 2021 · 0 comments · Fixed by #5994
Closed
7 tasks done

@vitejs/plugin-vue build failed #5925

sufuwang opened this issue Dec 2, 2021 · 0 comments · Fixed by #5994

Comments

@sufuwang
Copy link
Contributor

sufuwang commented Dec 2, 2021

Describe the bug

I use vite when build a miniprogram
node_modules/@vitejs/plugin-vue/dist/index.js have error
descriptor.styles.length is one , but query.index is one too , so

const block = descriptor.styles[index]; // block is undefined
const result = await compiler.compileStyleAsync(__spreadProps(__spreadValues({}, options.style), {
    filename: descriptor.filename,
    id: `data-v-${descriptor.id}`,
    isProd: options.isProduction,
    source: code,
    scoped: block.scoped // block.scoped have error
  }));
[vite:vue] Cannot read properties of undefined (reading 'scoped')
file: /Users/wangkai/Downloads/Code/uni-vite/src/styles/b.less?vue&type=style&index=1&src&lang.less
error during build:
TypeError: Cannot read properties of undefined (reading 'scoped')
    at transformStyle (/Users/wangkai/Downloads/Code/uni-vite/node_modules/@vitejs/plugin-vue/dist/index.js:4691:19)
    at Object.transform (/Users/wangkai/Downloads/Code/uni-vite/node_modules/@vitejs/plugin-vue/dist/index.js:4829:18)
    at /Users/wangkai/Downloads/Code/uni-vite/node_modules/rollup/dist/shared/rollup.js:22706:25
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Reproduction

https://github.com/sufuWang/uniapp_vite/tree/feature/vite

yarn build

System Info

mac os 12.0.1
node@14.17.3
vite@^2.6.14

Used Package Manager

yarn

Logs

No response

Validations

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.

1 participant