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

vite build fails with withDefaults and props extending from another interface #7343

Closed
7 tasks done
jd-solanki opened this issue Mar 16, 2022 · 5 comments
Closed
7 tasks done
Labels
bug: upstream Bug in a dependency of Vite

Comments

@jd-solanki
Copy link

Describe the bug

On this line if I use Props interface then it works fine. However, If I use SelectProps which extends from Props interface then the build fails with the below error:
image

Reproduction

https://github.com/jd-0001/vite-build-issue

System Info

System:
    OS: Linux 5.13 Ubuntu 21.10 21.10 (Impish Indri)
    CPU: (6) x64 Intel(R) Core(TM) i5-9400F CPU @ 2.90GHz
    Memory: 1.36 GB / 7.71 GB
    Container: Yes
    Shell: 5.1.8 - /bin/bash
  Binaries:
    Node: 16.14.0 - ~/.nvm/versions/node/v16.14.0/bin/node
    Yarn: 1.22.17 - ~/.nvm/versions/node/v16.14.0/bin/yarn
    npm: 8.3.1 - ~/.nvm/versions/node/v16.14.0/bin/npm
  Browsers:
    Chrome: 99.0.4844.51
  npmPackages:
    @vitejs/plugin-vue: ^2.2.0 => 2.2.4 
    vite: ^2.8.0 => 2.8.6

Used Package Manager

yarn

Logs

vite:config bundled config file loaded in 25.68ms +0ms
  vite:config using resolved config: {
  vite:config   build: {
  vite:config     target: [ 'es2019', 'edge88', 'firefox78', 'chrome87', 'safari13.1' ],
  vite:config     polyfillModulePreload: true,
  vite:config     outDir: 'dist',
  vite:config     assetsDir: 'assets',
  vite:config     assetsInlineLimit: 4096,
  vite:config     cssCodeSplit: false,
  vite:config     cssTarget: [ 'es2019', 'edge88', 'firefox78', 'chrome87', 'safari13.1' ],
  vite:config     sourcemap: false,
  vite:config     rollupOptions: { external: [Array], output: [Object] },
  vite:config     minify: 'esbuild',
  vite:config     terserOptions: {},
  vite:config     write: true,
  vite:config     emptyOutDir: null,
  vite:config     manifest: false,
  vite:config     lib: {
  vite:config       entry: '/home/jd/Projects/lab/vite-build-issue/src/index.ts',
  vite:config       name: 'mylib',
  vite:config       fileName: [Function: fileName]
  vite:config     },
  vite:config     ssr: false,
  vite:config     ssrManifest: false,
  vite:config     reportCompressedSize: true,
  vite:config     chunkSizeWarningLimit: 500,
  vite:config     watch: null,
  vite:config     commonjsOptions: { include: [Array], extensions: [Array] },
  vite:config     dynamicImportVarsOptions: { warnOnError: true, exclude: [Array] }
  vite:config   },
  vite:config   plugins: [
  vite:config     'alias',
  vite:config     'vite:modulepreload-polyfill',
  vite:config     'vite:resolve',
  vite:config     'vite:html-inline-proxy',
  vite:config     'vite:css',
  vite:config     'vite:esbuild',
  vite:config     'vite:json',
  vite:config     'vite:wasm',
  vite:config     'vite:worker',
  vite:config     'vite:worker-import-meta-url',
  vite:config     'vite:asset',
  vite:config     'vite:vue',
  vite:config     'vite:define',
  vite:config     'vite:css-post',
  vite:config     'vite:watch-package-data',
  vite:config     'vite:build-html',
  vite:config     'commonjs',
  vite:config     'vite:data-uri',
  vite:config     'rollup-plugin-dynamic-import-variables',
  vite:config     'vite:asset-import-meta-url',
  vite:config     'vite:build-import-analysis',
  vite:config     'vite:esbuild-transpile',
  vite:config     'vite:terser',
  vite:config     'vite:reporter',
  vite:config     'vite:load-fallback'
  vite:config   ],
  vite:config   define: { __VUE_OPTIONS_API__: true, __VUE_PROD_DEVTOOLS__: false },
  vite:config   ssr: { external: [ 'vue', '@vue/server-renderer' ] },
  vite:config   configFile: '/home/jd/Projects/lab/vite-build-issue/vite.config.ts',
  vite:config   configFileDependencies: [ 'vite.config.ts' ],
  vite:config   inlineConfig: {
  vite:config     root: undefined,
  vite:config     base: undefined,
  vite:config     mode: undefined,
  vite:config     configFile: undefined,
  vite:config     logLevel: undefined,
  vite:config     clearScreen: undefined,
  vite:config     build: {}
  vite:config   },
  vite:config   root: '/home/jd/Projects/lab/vite-build-issue',
  vite:config   base: '/',
  vite:config   resolve: { dedupe: undefined, alias: [ [Object], [Object] ] },
  vite:config   publicDir: '/home/jd/Projects/lab/vite-build-issue/public',
  vite:config   cacheDir: '/home/jd/Projects/lab/vite-build-issue/node_modules/.vite',
  vite:config   command: 'build',
  vite:config   mode: 'production',
  vite:config   isProduction: true,
  vite:config   server: {
  vite:config     preTransformRequests: true,
  vite:config     fs: { strict: true, allow: [Array], deny: [Array] }
  vite:config   },
  vite:config   preview: {
  vite:config     port: undefined,
  vite:config     strictPort: undefined,
  vite:config     host: undefined,
  vite:config     https: undefined,
  vite:config     open: undefined,
  vite:config     proxy: undefined,
  vite:config     cors: undefined,
  vite:config     headers: undefined
  vite:config   },
  vite:config   env: { BASE_URL: '/', MODE: 'production', DEV: false, PROD: true },
  vite:config   assetsInclude: [Function: assetsInclude],
  vite:config   logger: {
  vite:config     hasWarned: false,
  vite:config     info: [Function: info],
  vite:config     warn: [Function: warn],
  vite:config     warnOnce: [Function: warnOnce],
  vite:config     error: [Function: error],
  vite:config     clearScreen: [Function: clearScreen],
  vite:config     hasErrorLogged: [Function: hasErrorLogged]
  vite:config   },
  vite:config   packageCache: Map(0) { set: [Function (anonymous)] },
  vite:config   createResolver: [Function: createResolver],
  vite:config   optimizeDeps: {
  vite:config     esbuildOptions: { keepNames: undefined, preserveSymlinks: undefined }
  vite:config   },
  vite:config   worker: {
  vite:config     format: 'iife',
  vite:config     plugins: [
  vite:config       [Object], [Object], [Object],
  vite:config       [Object], [Object], [Object],
  vite:config       [Object], [Object], [Object],
  vite:config       [Object], [Object], [Object],
  vite:config       [Object], [Object], [Object],
  vite:config       [Object], [Object], [Object],
  vite:config       [Object], [Object], [Object],
  vite:config       [Object], [Object], [Object]
  vite:config     ],
  vite:config     rollupOptions: {}
  vite:config   }
  vite:config } +4ms
vite v2.8.6 building for production...
transforming (1) src/index.ts  vite:esbuild esbuild error with options used:  {
  sourcemap: false,
  sourcefile: '/home/jd/Projects/lab/vite-build-issue/src/select.vue',
  loader: 'ts',
  tsconfigRaw: { compilerOptions: { useDefineForClassFields: true } }
} +0ms
✓ 2 modules transformed.
[vite:vue] Transform failed with 1 error:
/home/jd/Projects/lab/vite-build-issue/src/select.vue:14:26: ERROR: Unexpected "}"
file: /home/jd/Projects/lab/vite-build-issue/src/select.vue:14:26

Unexpected "}"
12 |    setup(__props: any) {
13 |  
14 |  const props = __props as  }
   |                            ^
15 |  
16 |  

error during build:
Error: Transform failed with 1 error:
/home/jd/Projects/lab/vite-build-issue/src/select.vue:14:26: ERROR: Unexpected "}"
    at failureErrorWithLog (/home/jd/Projects/lab/vite-build-issue/node_modules/esbuild/lib/main.js:1599:15)
    at /home/jd/Projects/lab/vite-build-issue/node_modules/esbuild/lib/main.js:1388:29
    at /home/jd/Projects/lab/vite-build-issue/node_modules/esbuild/lib/main.js:662:9
    at handleIncomingPacket (/home/jd/Projects/lab/vite-build-issue/node_modules/esbuild/lib/main.js:759:9)
    at Socket.readFromStdout (/home/jd/Projects/lab/vite-build-issue/node_modules/esbuild/lib/main.js:629:7)
    at Socket.emit (node:events:520:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Validations

@jd-solanki
Copy link
Author

jd-solanki commented Mar 16, 2022

Also, props are treated as attrs. I get modelValue in attrs const attrs = useAttrs() and not as prop.

@sapphi-red
Copy link
Member

Looks like it is a bug with @vue/compiler-sfc.

reproduction with @vue/compiler-sfc

@Niputi Niputi added bug: upstream Bug in a dependency of Vite plugin: vue labels Mar 16, 2022
@jd-solanki
Copy link
Author

Should I raise this issue in vuejs repo or this is the correct place?

@sapphi-red
Copy link
Member

Yes, I think vuejs/core is the place.

@sodatea
Copy link
Member

sodatea commented Apr 25, 2022

Closing as it's already been tracked in the upstream library: vuejs/core#4498 and there's an open PR to fix it: vuejs/core#4512

@sodatea sodatea closed this as completed Apr 25, 2022
@github-actions github-actions bot locked and limited conversation to collaborators May 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug: upstream Bug in a dependency of Vite
Projects
None yet
Development

No branches or pull requests

4 participants