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

href="#" inside head tag make vite 2.0.0 build failed #2096

Closed
3 tasks
hjlld opened this issue Feb 19, 2021 · 4 comments · Fixed by #2097
Closed
3 tasks

href="#" inside head tag make vite 2.0.0 build failed #2096

hjlld opened this issue Feb 19, 2021 · 4 comments · Fixed by #2097

Comments

@hjlld
Copy link

hjlld commented Feb 19, 2021

⚠️ IMPORTANT ⚠️ Please check the following list before proceeding. If you ignore this issue template, your issue will be directly closed.

  • Read the docs.
  • Use Vite >=2.0. (1.x is no longer supported)
  • If the issue is related to 1.x -> 2.0 upgrade, read the Migration Guide first.

Describe the bug

href="#" inside head tag makes vite 2.0.0 build failed.

like:

  <head>
    <meta charset="UTF-8" />
    <!-- next line will casue vite build failed -->
    <link rel="icon" href="#" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Vite App</title>
  </head>

Reproduction

see this mini repo:
https://github.com/hjlld/vite-build-issue

or

  1. npm init @vitejs/app vite-build-issue
  2. template choose vanilla
  3. cd vite-build-issue
  4. npm i
  5. add <link rel="icon" href="#" /> to the head tag of index.html
  6. npm run build

System Info

  • vite version: 2.0.0
  • Operating System: WSL Ubuntu-18.04 under Windows 10
  • Node version: v14.7.0
  • Package manager (npm/yarn/pnpm) and version: npm v6.14.7

Logs (Optional if provided reproduction)

vite build log

> vite-build-issue@0.0.0 build /mnt/d/Code/vite-build-issue
> vite build --debug

  vite:config no config file found. +0ms
  vite:config using resolved config: {
  vite:config   root: '/mnt/d/Code/vite-build-issue',
  vite:config   base: '/',
  vite:config   mode: 'production',
  vite:config   configFile: undefined,
  vite:config   logLevel: undefined,
  vite:config   clearScreen: undefined,
  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   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   resolve: { dedupe: undefined, alias: [ [Object] ] },
  vite:config   publicDir: '/mnt/d/Code/vite-build-issue/public',
  vite:config   command: 'build',
  vite:config   isProduction: true,
  vite:config   optimizeCacheDir: '/mnt/d/Code/vite-build-issue/node_modules/.vite',
  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: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   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 } +4ms
building for production...
✓ 0 modules transformed.
[vite:build-html] EISDIR: illegal operation on a directory, read
file: /mnt/d/Code/vite-build-issue/index.html
error during build:
Error: EISDIR: illegal operation on a directory, read
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vite-build-issue@0.0.0 build: `vite build --debug`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vite-build-issue@0.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/hjlld/.npm/_logs/2021-02-19T11_28_18_746Z-debug.log

@yyx990803
Copy link
Member

What does this even do? # is not a valid asset URL.

@hjlld
Copy link
Author

hjlld commented Feb 20, 2021

when you don't have a favicon neither like the default nor seeing a 404 error in browser console, then use #.

@CHOYSEN
Copy link
Contributor

CHOYSEN commented Feb 20, 2021

What does this even do? # is not a valid asset URL.

I think it is a placeholder.

@jonaskuske
Copy link
Contributor

when you don't have a favicon neither like the default nor seeing a 404 error in browser console, then use #

You can also add <link rel="icon" href="data:image/svg+xml,<svg></svg>"

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
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.

4 participants