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

fix: template uses lang html for template, however it is not installed #17

Closed
7 tasks done
dargmuesli opened this issue Sep 8, 2022 · 1 comment · Fixed by #223
Closed
7 tasks done

fix: template uses lang html for template, however it is not installed #17

dargmuesli opened this issue Sep 8, 2022 · 1 comment · Fixed by #223
Labels
p3-minor-bug 🔨 An edge case that only affects very specific usage (priority)

Comments

@dargmuesli
Copy link
Contributor

Describe the bug

Setting lang="html" on a <template> tag causes the build to fail.
I expect html to be the default and to work even when I specify it unnecessarily.

Reproduction

https://stackblitz.com/edit/vitejs-vite-wdafsc?file=src/App.vue

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (4) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 16.14.2 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.17.0 - /usr/local/bin/npm
  npmPackages:
    @vitejs/plugin-vue: ^3.1.0 => 3.1.0 
    vite: ^3.1.0 => 3.1.0

Used Package Manager

npm

Logs

Click to expand!
vite build --debug
  vite:config bundled config file loaded in 1225.20ms +0ms
  vite:esbuild init tsconfck (root: /home/projects/vitejs-vite-wdafsc) +0ms
  vite:esbuild init tsconfck (root: /home/projects/vitejs-vite-wdafsc) +2ms
  vite:esbuild init tsconfck (root: /home/projects/vitejs-vite-wdafsc) +3ms
  vite:esbuild init tsconfck (root: /home/projects/vitejs-vite-wdafsc) +1ms
  vite:esbuild init tsconfck end +3ms
  vite:esbuild init tsconfck end +1ms
  vite:esbuild init tsconfck end +0ms
  vite:esbuild init tsconfck end +0ms
  vite:config using resolved config: {
  vite:config   plugins: [
  vite:config     'vite:build-metadata',
  vite:config     'vite:pre-alias',
  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-helper',
  vite:config     'vite:worker',
  vite:config     'vite:asset',
  vite:config     'vite:vue',
  vite:config     'vite:wasm-fallback',
  vite:config     'vite:define',
  vite:config     'vite:css-post',
  vite:config     'vite:build-html',
  vite:config     'vite:worker-import-meta-url',
  vite:config     'vite:force-systemjs-wrap-complete',
  vite:config     'vite:watch-package-data',
  vite:config     'commonjs',
  vite:config     'vite:data-uri',
  vite:config     'vite:asset-import-meta-url',
  vite:config     'vite:dynamic-import-vars',
  vite:config     'vite:import-glob',
  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   optimizeDeps: {
  vite:config     disabled: 'build',
  vite:config     force: undefined,
  vite:config     esbuildOptions: { preserveSymlinks: undefined }
  vite:config   },
  vite:config   build: {
  vite:config     target: [ 'es2020', 'edge88', 'firefox78', 'chrome87', 'safari13' ],
  vite:config     polyfillModulePreload: true,
  vite:config     outDir: 'dist',
  vite:config     assetsDir: 'assets',
  vite:config     assetsInlineLimit: 4096,
  vite:config     cssCodeSplit: true,
  vite:config     cssTarget: [ 'es2020', 'edge88', 'firefox78', 'chrome87', 'safari13' ],
  vite:config     sourcemap: false,
  vite:config     rollupOptions: {},
  vite:config     minify: 'esbuild',
  vite:config     terserOptions: {},
  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     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   define: { __VUE_OPTIONS_API__: true, __VUE_PROD_DEVTOOLS__: false },
  vite:config   ssr: {
  vite:config     format: 'esm',
  vite:config     target: 'node',
  vite:config     external: [],
  vite:config     optimizeDeps: { disabled: true, esbuildOptions: [Object] }
  vite:config   },
  vite:config   configFile: '/home/projects/vitejs-vite-wdafsc/vite.config.js',
  vite:config   configFileDependencies: [ '/home/projects/vitejs-vite-wdafsc/vite.config.js' ],
  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     build: {}
  vite:config   },
  vite:config   root: '/home/projects/vitejs-vite-wdafsc',
  vite:config   base: '/',
  vite:config   resolve: { alias: [ [Object], [Object] ] },
  vite:config   publicDir: '/home/projects/vitejs-vite-wdafsc/public',
  vite:config   cacheDir: '/home/projects/vitejs-vite-wdafsc/node_modules/.vite',
  vite:config   command: 'build',
  vite:config   mode: 'production',
  vite:config   isWorker: false,
  vite:config   mainConfig: null,
  vite:config   isProduction: true,
  vite:config   server: {
  vite:config     preTransformRequests: true,
  vite:config     middlewareMode: false,
  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   worker: {
  vite:config     format: 'iife',
  vite:config     plugins: [
  vite:config       'vite:build-metadata',
  vite:config       'vite:pre-alias',
  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-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:build-html',
  vite:config       'vite:worker-import-meta-url',
  vite:config       'vite:force-systemjs-wrap-complete',
  vite:config       'vite:watch-package-data',
  vite:config       'commonjs',
  vite:config       'vite:data-uri',
  vite:config       'vite:asset-import-meta-url',
  vite:config       'vite:dynamic-import-vars',
  vite:config       'vite:import-glob',
  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     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 } +23ms
vite v3.1.0 building for production...
✓ 3 modules transformed.
[vite:vue] Component /home/projects/vitejs-vite-wdafsc/src/App.vue uses lang html for template, however it is not installed.
file: /home/projects/vitejs-vite-wdafsc/src/App.vue
error during build:
Error: Component /home/projects/vitejs-vite-wdafsc/src/App.vue uses lang html for template, however it is not installed.
    at compileScript@/home/projects/vitejs-vite-wdafsc/node_modules/ (vue/compiler-sfc/dist/compiler-sfc.cjs.js:4390:23)
    at resolveScript@file:///home/projects/vitejs-vite-wdafsc/node_modules/ (vitejs/plugin-vue/dist/index.mjs:282:31)
    at genScriptCode@file:///home/projects/vitejs-vite-wdafsc/node_modules/ (vitejs/plugin-vue/dist/index.mjs:2362:31)
    at transformMain@file:///home/projects/vitejs-vite-wdafsc/node_modules/ (vitejs/plugin-vue/dist/index.mjs:2183:54)
    at transform@file:///home/projects/vitejs-vite-wdafsc/node_modules/ (vitejs/plugin-vue/dist/index.mjs:2658:16)
    at runHook/< (file:///home/projects/vitejs-vite-wdafsc/node_modules/rollup/dist/es/shared/rollup.js:22740:40)
    at <anonymous> (<anonymous>)

Validations

@sapphi-red
Copy link
Member

It seems <script lang="js"> also does not work but <style lang="css"> works.

As the SFC spec says pre-processor languages and HTML is not a pre-processor language, I'm not sure if this is a bug.

Blocks can declare pre-processor languages using the lang attribute.
https://vuejs.org/api/sfc-spec.html#pre-processors

But Vue CLI (vue-loader) seems to work. (stackblitz)

@haoqunjiang haoqunjiang transferred this issue from vitejs/vite Dec 3, 2022
@sapphi-red sapphi-red added the p3-minor-bug 🔨 An edge case that only affects very specific usage (priority) label Jan 25, 2023
haoqunjiang pushed a commit that referenced this issue Aug 11, 2023
Co-authored-by: sapphi-red <green@sapphi.red>

Fixes #17
@github-actions github-actions bot locked and limited conversation to collaborators Aug 26, 2023
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
p3-minor-bug 🔨 An edge case that only affects very specific usage (priority)
Projects
None yet
2 participants