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

Cannot load HTML when filename contains non-ASCII characters and with module <script> #13527

Closed
7 tasks done
bczhc opened this issue Jun 15, 2023 · 3 comments · Fixed by #13581
Closed
7 tasks done

Cannot load HTML when filename contains non-ASCII characters and with module <script> #13527

bczhc opened this issue Jun 15, 2023 · 3 comments · Fixed by #13581
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@bczhc
Copy link

bczhc commented Jun 15, 2023

Describe the bug

I started a very basic Vite project, with a link to another HTML. But when the linked HTML filename contains non-ASCII, this error will occur on loading: htmlProxyMap.get(...).get(...) is undefined

Reproduction

https://stackblitz.com/edit/vitejs-vite-q7zxua?file=index.html

Steps to reproduce

  • Open the reproduction link
  • Click á button
  • Error shows

You can notice there are three HTML files: a and á have the exactly same content, but plain a can be loaded successfully, the acute one can't be. á2 also has the same content except using <script> instead of <script type="module">, and it can be loaded as well.

System Info

System:
    OS: Linux 6.3 Arch Linux
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
    Memory: 28.45 GB / 62.55 GB
    Container: Yes
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.2.0 - /usr/bin/node
    Yarn: 1.22.19 - /usr/bin/yarn
    npm: 9.6.7 - /usr/bin/npm
  Browsers:
    Chromium: 114.0.5735.106
    Firefox: 114.0.1

Used Package Manager

npm

Logs

Click to expand!
~/projects/vitejs-vite-q7zxua
❯ vite --debug
  vite:config no config file found. +0ms
  vite:config using resolved config: {
  vite:config   root: '/home/projects/vitejs-vite-q7zxua',
  vite:config   base: '/',
  vite:config   mode: 'development',
  vite:config   configFile: undefined,
  vite:config   logLevel: undefined,
  vite:config   clearScreen: undefined,
  vite:config   optimizeDeps: {
  vite:config     disabled: 'build',
  vite:config     force: undefined,
  vite:config     esbuildOptions: { preserveSymlinks: false }
  vite:config   },
  vite:config   server: {
  vite:config     preTransformRequests: true,
  vite:config     sourcemapIgnoreList: [Function: isInNodeModules],
  vite:config     middlewareMode: false,
  vite:config     fs: { strict: true, allow: [Array], deny: [Array] }
  vite:config   },
  vite:config   configFileDependencies: [],
  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   rawBase: '/',
  vite:config   resolve: {
  vite:config     mainFields: [ 'module', 'jsnext:main', 'jsnext' ],
  vite:config     browserField: true,
  vite:config     conditions: [],
  vite:config     extensions: [
  vite:config       '.mjs',  '.js',
  vite:config       '.mts',  '.ts',
  vite:config       '.jsx',  '.tsx',
  vite:config       '.json'
  vite:config     ],
  vite:config     dedupe: [],
  vite:config     preserveSymlinks: false,
  vite:config     alias: [ [Object], [Object] ]
  vite:config   },
  vite:config   publicDir: '/home/projects/vitejs-vite-q7zxua/public',
  vite:config   cacheDir: '/home/projects/vitejs-vite-q7zxua/node_modules/.vite',
  vite:config   command: 'serve',
  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   plugins: [
  vite:config     'vite:optimized-deps',
  vite:config     'vite:watch-package-data',
  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:worker-import-meta-url',
  vite:config     'vite:asset-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   esbuild: { jsxDev: true },
  vite:config   build: {
  vite:config     target: [ 'es2020', 'edge88', 'firefox78', 'chrome87', 'safari14' ],
  vite:config     cssTarget: [ 'es2020', 'edge88', 'firefox78', 'chrome87', 'safari14' ],
  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     minify: 'esbuild',
  vite:config     terserOptions: {},
  vite:config     write: true,
  vite:config     emptyOutDir: null,
  vite:config     copyPublicDir: true,
  vite:config     manifest: false,
  vite:config     lib: false,
  vite:config     ssr: false,
  vite:config     ssrManifest: false,
  vite:config     ssrEmitAssets: 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     modulePreload: { polyfill: true },
  vite:config     cssMinify: true
  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   envDir: '/home/projects/vitejs-vite-q7zxua',
  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(1) {
  vite:config     'fnpd_/home/projects/vitejs-vite-q7zxua' => {
  vite:config       dir: '/home/projects/vitejs-vite-q7zxua',
  vite:config       data: [Object],
  vite:config       hasSideEffects: [Function: hasSideEffects],
  vite:config       webResolvedImports: {},
  vite:config       nodeResolvedImports: {},
  vite:config       setResolvedCache: [Function: setResolvedCache],
  vite:config       getResolvedCache: [Function: getResolvedCache]
  vite:config     },
  vite:config     set: [Function (anonymous)]
  vite:config   },
  vite:config   createResolver: [Function: createResolver],
  vite:config   worker: {
  vite:config     format: 'iife',
  vite:config     plugins: [
  vite:config       'vite:optimized-deps',
  vite:config       'vite:watch-package-data',
  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:worker-import-meta-url',
  vite:config       'vite:asset-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 } +14ms
  vite:esbuild 29.76ms tsconfck init /home/projects/vitejs-vite-q7zxua +0ms
  vite:deps scanning for dependencies... +0ms

  VITE v4.3.9  ready in 1729 ms

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
  ➜  press h to show help
  vite:deps Crawling dependencies using entries: 
  vite:deps   /home/projects/vitejs-vite-q7zxua/index.html
  vite:deps   /home/projects/vitejs-vite-q7zxua/src/a.html
  vite:deps   /home/projects/vitejs-vite-q7zxua/src/á.html +0ms
  vite:html-fallback Not rewriting GET /src/%C3%A1.html because the path includes a dot (.) character. +0ms
  vite:time 204.30ms /src/%C3%A1.html +0ms
  vite:load 0.76ms [plugin] /src/%C3%A1.html?html-proxy&index=0.js +0ms
  vite:import-analysis 0.36ms [no imports] /src/%C3%A1.html?html-proxy&index=0.js +0ms
  vite:transform 3.78ms /src/%C3%A1.html?html-proxy&index=0.js +0ms
  vite:resolve 1.26ms /@vite/client -> /home/projects/vitejs-vite-q7zxua/node_modules/vite/dist/client/client.mjs +0ms
  vite:resolve 3.26ms /src/á.html?html-proxy&index=0.js -> /home/projects/vitejs-vite-q7zxua/src/á.html?html-proxy&index=0.js +11ms
5:54:34 PM [vite] Internal server error: htmlProxyMap.get(...).get(...) is undefined
  
  vite:time 10.92ms /src/%C3%A1.html?html-proxy&index=0.js +267ms
  vite:load 20.26ms [fs] /@vite/client +264ms
  vite:resolve 0.32ms @vite/env -> /home/projects/vitejs-vite-q7zxua/node_modules/vite/dist/client/env.mjs +17ms
  vite:import-analysis 5.42ms [1 imports rewritten] node_modules/vite/dist/client/client.mjs +269ms
  vite:transform 6.66ms /@vite/client +269ms
  vite:time 42.68ms /@vite/client +23ms
  vite:load 15.28ms [fs] /node_modules/vite/dist/client/env.mjs +24ms
  vite:import-analysis 0.14ms [no imports] node_modules/vite/dist/client/env.mjs +18ms
  vite:transform 0.92ms /node_modules/vite/dist/client/env.mjs +18ms
  vite:cache [memory] /node_modules/vite/dist/client/env.mjs +0ms
  vite:time 1.58ms /node_modules/vite/dist/client/env.mjs +30ms
  vite:deps ✨ static imports crawl ended +990ms
  vite:deps Scan completed in 1030.62ms: no dependencies found +996ms
  vite:deps ✨ no dependencies found by the scanner or crawling static imports +47ms

Validations

@stackblitz
Copy link

stackblitz bot commented Jun 15, 2023

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@bczhc
Copy link
Author

bczhc commented Jun 15, 2023

I found filenames with space also cause the loading error!

@sapphi-red
Copy link
Member

It looks similar to #9446 (comment)

@sapphi-red sapphi-red added the p3-minor-bug An edge case that only affects very specific usage (priority) label Jun 15, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jul 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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