Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Self-closing tags of non-void elements no longer works in vite 3.1.0 #10439

Closed
7 tasks done
Tanimodori opened this issue Oct 12, 2022 · 0 comments · Fixed by #10478
Closed
7 tasks done

Self-closing tags of non-void elements no longer works in vite 3.1.0 #10439

Tanimodori opened this issue Oct 12, 2022 · 0 comments · Fixed by #10478
Labels
feat: html p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@Tanimodori
Copy link

Describe the bug

Vite uses parse5 since 3.1.0 which will throw an error when non-void element start tag has a trailing slash (known as solidus), even on virtual template elements (<vue-component /> from ngVue in this case). This error stops the server from running. If a breaking change to drop support for those tags is decided to be made, please make a clarification at least.

keywords: Internal server error: Unable to parse HTML; parse5 error code non-void-html-element-start-tag-with-trailing-solidus

Reproduction

https://github.com/Tanimodori/ngvue-vite

Steps to reproduce

  • cd ngvue-vite
  • git checkout broken
  • npm i
  • npm run dev

System Info

System:
    OS: Windows 10 10.0.22621
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
    Memory: 6.35 GB / 15.69 GB
  Binaries:
    Node: 16.16.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 8.15.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22621.521.0), Chromium (106.0.1370.42)
    Internet Explorer: 11.0.22621.1
  npmPackages:
    @vitejs/plugin-vue2: ^2.0.0 => 2.0.0
    vite: ^3.0.9 => 3.1.0

Used Package Manager

npm

Logs

Click to expand!
vite:config bundled config file loaded in 84.47ms +0ms
  vite:esbuild init tsconfck (root: C:/path/to/project/ngvue-vite) +0ms
  vite:esbuild init tsconfck (root: C:/path/to/project/ngvue-vite) +2ms
  vite:esbuild init tsconfck end +2ms
  vite:esbuild init tsconfck end +0ms
  vite:config using resolved config: {
  vite:config   root: 'C:/path/to/project/ngvue-vite',
  vite:config   resolve: { alias: [ [Object], [Object], [Object], [Object] ] },
  vite:config   build: {
  vite:config     target: 'esnext',
  vite:config     polyfillModulePreload: true,
  vite:config     outDir: 'dist',
  vite:config     assetsDir: 'assets',
  vite:config     assetsInlineLimit: 4096,
  vite:config     cssCodeSplit: true,
  vite:config     cssTarget: 'esnext',
  vite:config     sourcemap: false,
  vite:config     rollupOptions: {},
  vite:config     minify: false,
  vite:config     terserOptions: {},
  vite:config     write: true,
  vite:config     emptyOutDir: true,
  vite:config     manifest: false,
  vite:config     lib: false,
  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     'vite:pre-alias',
  vite:config     'alias',
  vite:config     'vite:modulepreload-polyfill',
  vite:config     'vite:optimized-deps',
  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-helper',
  vite:config     'vite:worker',
  vite:config     'vite:asset',
  vite:config     'vite:vue2',
  vite:config     'vite:wasm-fallback',
  vite:config     'vite:define',
  vite:config     'vite:css-post',
  vite:config     'vite:worker-import-meta-url',
  vite:config     'vite:dynamic-import-vars',
  vite:config     'vite:import-glob',
  vite:config     'vite:client-inject',
  vite:config     'vite:import-analysis'
  vite:config   ],
  vite:config   optimizeDeps: {
  vite:config     disabled: 'build',
  vite:config     force: undefined,
  vite:config     esbuildOptions: { preserveSymlinks: undefined }
  vite:config   },
  vite:config   server: {
  vite:config     preTransformRequests: true,
  vite:config     middlewareMode: false,
  vite:config     fs: { strict: true, allow: [Array], deny: [Array] }
  vite:config   },
  vite:config   configFile: 'C:/path/to/project/ngvue-vite/vite.config.ts',
  vite:config   configFileDependencies: [ 'C:/path/to/project/ngvue-vite/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     optimizeDeps: { force: undefined },
  vite:config     server: {}
  vite:config   },
  vite:config   base: '/',
  vite:config   publicDir: 'C:\\path\\to\\project\\ngvue-vite\\public',
  vite:config   cacheDir: 'C:\\path\\to\\project\\ngvue-vite\\node_modules\\.vite',
  vite:config   command: 'serve',
  vite:config   mode: 'development',
  vite:config   ssr: {
  vite:config     format: 'esm',
  vite:config     target: 'node',
  vite:config     optimizeDeps: { disabled: true, esbuildOptions: [Object] }
  vite:config   },
  vite:config   isWorker: false,
  vite:config   mainConfig: null,
  vite:config   isProduction: false,
  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: 'development', DEV: true, PROD: false },
  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) {},
  vite:config   createResolver: [Function: createResolver],
  vite:config   worker: {
  vite:config     format: 'iife',
  vite:config     plugins: [
  vite:config       'vite:pre-alias',
  vite:config       'alias',
  vite:config       'vite:modulepreload-polyfill',
  vite:config       'vite:optimized-deps',
  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-helper',
  vite:config       'vite:worker',
  vite:config       'vite:asset',
  vite:config       'vite:wasm-fallback',
  vite:config       'vite:define',
  vite:config       'vite:css-post',
  vite:config       'vite:worker-import-meta-url',
  vite:config       'vite:dynamic-import-vars',
  vite:config       'vite:import-glob',
  vite:config       'vite:client-inject',
  vite:config       'vite:import-analysis'
  vite:config     ],
  vite:config     rollupOptions: {},
  vite:config     getSortedPlugins: [Function: getSortedPlugins],
  vite:config     getSortedPluginHooks: [Function: getSortedPluginHooks]
  vite:config   },
  vite:config   appType: 'spa',
  vite:config   experimental: { importGlobRestoreExtension: false, hmrPartialAccept: false },
  vite:config   getSortedPlugins: [Function: getSortedPlugins],
  vite:config   getSortedPluginHooks: [Function: getSortedPluginHooks]
  vite:config } +11ms
  vite:deps scanning for dependencies... +0ms

  VITE v3.1.0  ready in 359 ms

  ➜  Local:   http://127.0.0.1:5173/
  ➜  Network: use --host to expose
  vite:deps Crawling dependencies using entries:
  vite:deps   C:/path/to/project/ngvue-vite/index.html +0ms
  vite:resolve 1.08ms ./src/index.ts -> C:/path/to/project/ngvue-vite/src/index.ts +0ms
  vite:resolve 7.76ms jquery -> C:/path/to/project/ngvue-vite/node_modules/jquery/dist/jquery.js +10ms
  vite:spa-fallback Rewriting GET / to /index.html +0ms
  vite:resolve 5.51ms angular -> C:/path/to/project/ngvue-vite/node_modules/angular/index.js +17ms
  vite:resolve 2.90ms vue -> C:/path/to/project/ngvue-vite/node_modules/vue/dist/vue.runtime.esm.js +3ms
  vite:resolve 2.92ms ngVue -> C:/path/to/project/ngvue-vite/node_modules/ngVue/build/index.esm.js +3ms
  vite:resolve 1.61ms ./app -> C:/path/to/project/ngvue-vite/src/app.ts +3ms
15:13:19 [vite] Internal server error: Unable to parse HTML; parse5 error code non-void-html-element-start-tag-with-trailing-solidus
 at {"file":"/index.html","line":12,"column":7}
10 |    <body>
11 |      <div ng-controller="AppCtrl" id="app">
12 |        <vue-component name="AppView" />
   |                   ^
13 |      </div>
14 |      <script src="./src/index.ts" type="module"></script>
   at {"file":"/index.html","line":12,"column":7}
      at handleParseError (file:///C:/path/to/project/ngvue-vite/node_modules/vite/dist/node/chunks/dep-665b0112.js:43301:11)
      at Parser.onParseError (file:///C:/path/to/project/ngvue-vite/node_modules/vite/dist/node/chunks/dep-665b0112.js:43228:13)
      at Parser._err (file:///C:/path/to/project/ngvue-vite/node_modules/vite/dist/node/chunks/dep-4069c338.js:4949:14)
      at Parser.onStartTag (file:///C:/path/to/project/ngvue-vite/node_modules/vite/dist/node/chunks/dep-4069c338.js:5533:18)
      at Tokenizer.emitCurrentTagToken (file:///C:/path/to/project/ngvue-vite/node_modules/vite/dist/node/chunks/dep-4069c338.js:1337:26)
      at Tokenizer._stateSelfClosingStartTag (file:///C:/path/to/project/ngvue-vite/node_modules/vite/dist/node/chunks/dep-4069c338.js:2771:22)
      at Tokenizer._callState (file:///C:/path/to/project/ngvue-vite/node_modules/vite/dist/node/chunks/dep-4069c338.js:1663:22)
      at Tokenizer._runParsingLoop (file:///C:/path/to/project/ngvue-vite/node_modules/vite/dist/node/chunks/dep-4069c338.js:1170:22)
      at Tokenizer.write (file:///C:/path/to/project/ngvue-vite/node_modules/vite/dist/node/chunks/dep-4069c338.js:1195:14)
      at Function.parse (file:///C:/path/to/project/ngvue-vite/node_modules/vite/dist/node/chunks/dep-4069c338.js:4903:26)
  vite:time 70.60ms /index.html +0ms
  vite:resolve 0.75ms C:\path\to\project\ngvue-vite\src/views/AppView.vue -> C:/path/to/project/ngvue-vite/src/views/AppView.vue +64ms
  vite:resolve 1.21ms @/views/AppView.vue -> C:/path/to/project/ngvue-vite/src/views/AppView.vue +1ms
  vite:spa-fallback Rewriting GET / to /index.html +94ms
15:13:19 [vite] Internal server error: Unable to parse HTML; parse5 error code non-void-html-element-start-tag-with-trailing-solidus
 at {"file":"/index.html","line":12,"column":7}
10 |    <body>
11 |      <div ng-controller="AppCtrl" id="app">
12 |        <vue-component name="AppView" />
   |                   ^
13 |      </div>
} +166ms
  vite:deps dependencies found by scanner: angular, jquery, ngVue, vue +219ms
  vite:resolve 3.77ms angular -> C:/path/to/project/ngvue-vite/node_modules/angular/index.js +0ms
  vite:resolve 16.54ms vue/dist/vue.runtime.esm.js -> C:/path/to/project/ngvue-vite/node_modules/vue/dist/vue.runtime.esm.js +21ms
  vite:resolve 17.28ms vue -> C:/path/to/project/ngvue-vite/node_modules/vue/dist/vue.runtime.esm.js +0ms
  vite:resolve 1.24ms C:\path\to\project\ngvue-vite\node_modules\vite\dist\client\client.mjs -> C:/path/to/project/ngvue-vite/node_modules/vite/dist/client/client.mjs +0ms
  vite:resolve 1.93ms /@vite/client -> C:/path/to/project/ngvue-vite/node_modules/vite/dist/client/client.mjs +1ms
  vite:load 4.21ms [fs] /@vite/client +0ms
  vite:deps deps bundled in 191.76ms +224ms
  vite:resolve 2.38ms C:\path\to\project\ngvue-vite\node_modules\vite\dist\client\env.mjs -> C:/path/to/project/ngvue-vite/node_modules/vite/dist/client/env.mjs +32ms
  vite:resolve 2.87ms @vite/env -> C:/path/to/project/ngvue-vite/node_modules/vite/dist/client/env.mjs +0ms
  vite:resolve 1.08ms /node_modules/vite/dist/client/env.mjs -> C:/path/to/project/ngvue-vite/node_modules/vite/dist/client/env.mjs +2ms
  vite:import-analysis 8.05ms [1 imports rewritten] node_modules\vite\dist\client\client.mjs +0ms
  vite:transform 28.37ms /@vite/client +0ms
  vite:time 50.99ms /@vite/client +256ms
  vite:load 1.32ms [fs] /node_modules/vite/dist/client/env.mjs +44ms
  vite:import-analysis 0.63ms [no imports] node_modules\vite\dist\client\env.mjs +24ms
  vite:transform 7.36ms /node_modules/vite/dist/client/env.mjs +21ms
  vite:cache [304] /node_modules/vite/dist/client/env.mjs +0ms
  vite:time 1.41ms /node_modules/vite/dist/client/env.mjs +32ms
  vite:deps ✨ static imports crawl ended +234ms
  vite:deps ✨ using post-scan optimizer result, the scanner found every used dependency +2ms
  vite:deps ✨ dependencies optimized +5ms

Validations

@bluwy bluwy added feat: html p3-minor-bug An edge case that only affects very specific usage (priority) and removed pending triage labels Oct 15, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Oct 30, 2022
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
feat: html p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants