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

v-slot syntax not working with pug #2485

Closed
3 tasks done
Shinigami92 opened this issue Mar 12, 2021 · 4 comments
Closed
3 tasks done

v-slot syntax not working with pug #2485

Shinigami92 opened this issue Mar 12, 2021 · 4 comments

Comments

@Shinigami92
Copy link
Member

Describe the bug

v-slot syntax is not working in combination with pug

Reproduction

https://github.com/Shinigami92/vite-pug-error-repro

System Info

  • vite version: 2.0.5
  • Operating System: arch linux
  • Node version: 15
  • Package manager (npm/yarn/pnpm) and version: yarn 1

Logs (Optional if provided reproduction)

  1. Run vite or vite build with the --debug flag.
  2. Provide the error log here.
 ~/OpenSource/vite-pug-error-repro  main  yarn build --debug                                                                                       ✔  18:01:47 
yarn run v1.22.10
$ vite build --debug
  vite:config bundled config file loaded in 189ms +0ms
  vite:config using resolved config: {
  vite:config   plugins: [
  vite:config     'alias',
  vite:config     'vite:dynamic-import-polyfill',
  vite:config     'vite:resolve',
  vite:config     'vite:html',
  vite:config     'vite:css',
  vite:config     'vite:esbuild',
  vite:config     'vite:json',
  vite:config     'vite:wasm',
  vite:config     'vite:worker',
  vite:config     'vite:asset',
  vite:config     'vite-plugin-vue2',
  vite:config     'vite:define',
  vite:config     'vite:css-post',
  vite:config     'vite:build-html',
  vite:config     'commonjs',
  vite:config     'vite:data-uri',
  vite:config     'rollup-plugin-dynamic-import-variables',
  vite:config     'vite:import-analysis',
  vite:config     'vite:esbuild-transpile',
  vite:config     'vite:terser',
  vite:config     'vite:reporter'
  vite:config   ],
  vite:config   resolve: { dedupe: undefined, alias: [ [Object], [Object] ] },
  vite:config   build: {
  vite:config     target: [ 'es2019', 'edge16', 'firefox60', 'chrome61', 'safari11' ],
  vite:config     polyfillDynamicImport: true,
  vite:config     outDir: 'dist',
  vite:config     assetsDir: 'assets',
  vite:config     assetsInlineLimit: 4096,
  vite:config     cssCodeSplit: true,
  vite:config     sourcemap: false,
  vite:config     rollupOptions: {},
  vite:config     commonjsOptions: { include: [Array], extensions: [Array] },
  vite:config     minify: 'terser',
  vite:config     terserOptions: {},
  vite:config     cleanCssOptions: {},
  vite:config     write: true,
  vite:config     emptyOutDir: null,
  vite:config     manifest: false,
  vite:config     lib: false,
  vite:config     ssr: false,
  vite:config     ssrManifest: false,
  vite:config     brotliSize: true,
  vite:config     chunkSizeWarningLimit: 500
  vite:config   },
  vite:config   configFile: '/home/shinigami/OpenSource/vite-pug-error-repro/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/shinigami/OpenSource/vite-pug-error-repro',
  vite:config   base: '/',
  vite:config   publicDir: '/home/shinigami/OpenSource/vite-pug-error-repro/public',
  vite:config   command: 'build',
  vite:config   mode: 'production',
  vite:config   isProduction: true,
  vite:config   optimizeCacheDir: '/home/shinigami/OpenSource/vite-pug-error-repro/node_modules/.vite',
  vite:config   server: {},
  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     error: [Function: error],
  vite:config     clearScreen: [Function: clearScreen]
  vite:config   },
  vite:config   createResolver: [Function: createResolver]
  vite:config } +3ms
vite v2.0.5 building for production...
✓ 5 modules transformed.
[vite-plugin-vue2] Unexpected token (1:247)
file: /home/shinigami/OpenSource/vite-pug-error-repro/src/App.pug?vue&type=template&src&lang.js:1:247
error during build:
SyntaxError: Unexpected token (1:247)
    at Parser.pp$4.raise (/home/shinigami/OpenSource/vite-pug-error-repro/node_modules/vue-template-es2015-compiler/buble.js:2757:13)
    at Parser.pp.unexpected (/home/shinigami/OpenSource/vite-pug-error-repro/node_modules/vue-template-es2015-compiler/buble.js:647:8)
    at Parser.pp.expect (/home/shinigami/OpenSource/vite-pug-error-repro/node_modules/vue-template-es2015-compiler/buble.js:641:26)
    at Parser.pp$2.parseBindingList (/home/shinigami/OpenSource/vite-pug-error-repro/node_modules/vue-template-es2015-compiler/buble.js:1694:19)
    at Parser.pp$1.parseFunctionParams (/home/shinigami/OpenSource/vite-pug-error-repro/node_modules/vue-template-es2015-compiler/buble.js:1231:22)
    at Parser.pp$1.parseFunction (/home/shinigami/OpenSource/vite-pug-error-repro/node_modules/vue-template-es2015-compiler/buble.js:1218:8)
    at Parser.pp$3.parseExprAtom (/home/shinigami/OpenSource/vite-pug-error-repro/node_modules/vue-template-es2015-compiler/buble.js:2184:17)
    at Parser.<anonymous> (/home/shinigami/OpenSource/vite-pug-error-repro/node_modules/vue-template-es2015-compiler/buble.js:6003:24)
    at Parser.parseExprAtom (/home/shinigami/OpenSource/vite-pug-error-repro/node_modules/vue-template-es2015-compiler/buble.js:6129:31)
    at Parser.pp$3.parseExprSubscripts (/home/shinigami/OpenSource/vite-pug-error-repro/node_modules/vue-template-es2015-compiler/buble.js:2047:19)
    at Parser.pp$3.parseMaybeUnary (/home/shinigami/OpenSource/vite-pug-error-repro/node_modules/vue-template-es2015-compiler/buble.js:2024:17)
    at Parser.pp$3.parseExprOps (/home/shinigami/OpenSource/vite-pug-error-repro/node_modules/vue-template-es2015-compiler/buble.js:1966:19)
    at Parser.pp$3.parseMaybeConditional (/home/shinigami/OpenSource/vite-pug-error-repro/node_modules/vue-template-es2015-compiler/buble.js:1949:19)
    at Parser.pp$3.parseMaybeAssign (/home/shinigami/OpenSource/vite-pug-error-repro/node_modules/vue-template-es2015-compiler/buble.js:1925:19)
    at Parser.pp$3.parsePropertyValue (/home/shinigami/OpenSource/vite-pug-error-repro/node_modules/vue-template-es2015-compiler/buble.js:2443:87)
    at Parser.pp$3.parseProperty (/home/shinigami/OpenSource/vite-pug-error-repro/node_modules/vue-template-es2015-compiler/buble.js:2434:8)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@Deckluhm
Copy link
Contributor

Note that this is working fine in a Vue 3 project generated with Vite create-app so it's probably a problem specific to Vue 2 template.

@Shinigami92
Copy link
Member Author

Note that this is working fine in a Vue 3 project generated with Vite create-app so it's probably a problem specific to Vue 2 template.

So you mean it could be a bug from vite-plugin-vue2?
Do you have a repro vue 3 + vite + pug using v-slot that you can link here?
Otherwise I could try setup a repro tomorrow.

@Deckluhm
Copy link
Contributor

So you mean it could be a bug from vite-plugin-vue2?

Yes, probably (since this is the only thing different between your setup and mine).

Do you have a repro vue 3 + vite + pug using v-slot that you can link here?

I don't have a small enough repro to share right now, sorry.

@Shinigami92
Copy link
Member Author

@underfin I can confirm vite-plugin-vue2 v1.4 now works 🎉 👍

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
antfu pushed a commit that referenced this issue Oct 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants