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

space in file names causes build failure #218

Closed
danielroe opened this issue Mar 12, 2022 · 2 comments
Closed

space in file names causes build failure #218

danielroe opened this issue Mar 12, 2022 · 2 comments
Assignees
Labels
bug: upstream Bug in a dependency of this repository p3-minor-bug 🔨 An edge case that only affects very specific usage (priority)

Comments

@danielroe
Copy link

Describe the bug

Adding a space in a public asset file name causes a build (but not development) failure.

Originally reported at nuxt/nuxt#13494.

Reproduction

https://stackblitz.com/edit/vitejs-vite-o8aged

System Info

System:
    OS: macOS 12.2.1
    CPU: (8) x64 Apple M1
    Memory: 59.79 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.18.3 - ~/.volta/tools/image/node/14.18.3/bin/node
    Yarn: 3.2.0 - ~/.volta/tools/image/yarn/1.22.17/bin/yarn
    npm: 8.3.2 - ~/.volta/tools/image/npm/8.3.2/bin/npm
  Browsers:
    Brave Browser: 97.1.34.80
    Edge: 99.0.1150.39
    Firefox Developer Edition: 99.0
    Safari: 15.3

Used Package Manager

yarn

Logs

$ vite build --debug
  vite:config bundled config file loaded in 119.00ms +0ms
  vite:config using resolved config: {
  vite:config   plugins: [
  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',
  vite:config     'vite:worker',
  vite:config     'vite:worker-import-meta-url',
  vite:config     'vite:asset',
  vite:config     'vite:vue',
  vite:config     'vite:define',
  vite:config     'vite:css-post',
  vite:config     'vite:watch-package-data',
  vite:config     'vite:build-html',
  vite:config     'commonjs',
  vite:config     'vite:data-uri',
  vite:config     'rollup-plugin-dynamic-import-variables',
  vite:config     'vite:asset-import-meta-url',
  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   build: {
  vite:config     target: [ 'es2019', 'edge88', 'firefox78', 'chrome87', 'safari13.1' ],
  vite:config     polyfillModulePreload: true,
  vite:config     outDir: 'dist',
  vite:config     assetsDir: 'assets',
  vite:config     assetsInlineLimit: 4096,
  vite:config     cssCodeSplit: true,
  vite:config     cssTarget: [ 'es2019', 'edge88', 'firefox78', 'chrome87', 'safari13.1' ],
  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: { external: [ 'vue', '@vue/server-renderer' ] },
  vite:config   configFile: '/home/projects/vitejs-vite-o8aged/vite.config.js',
  vite:config   configFileDependencies: [ '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     build: {}
  vite:config   },
  vite:config   root: '/home/projects/vitejs-vite-o8aged',
  vite:config   base: '/',
  vite:config   resolve: { dedupe: undefined, alias: [ [Object], [Object] ] },
  vite:config   publicDir: '/home/projects/vitejs-vite-o8aged/public',
  vite:config   cacheDir: '/home/projects/vitejs-vite-o8aged/node_modules/.vite',
  vite:config   command: 'build',
  vite:config   mode: 'production',
  vite:config   isProduction: true,
  vite:config   server: {
  vite:config     preTransformRequests: true,
  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   optimizeDeps: {
  vite:config     esbuildOptions: { keepNames: undefined, preserveSymlinks: undefined }
  vite:config   },
  vite:config   worker: {
  vite:config     format: 'iife',
  vite:config     plugins: [
  vite:config       [Object], [Object], [Object],
  vite:config       [Object], [Object], [Object],
  vite:config       [Object], [Object], [Object],
  vite:config       [Object], [Object], [Object],
  vite:config       [Object], [Object], [Object],
  vite:config       [Object], [Object], [Object],
  vite:config       [Object], [Object], [Object],
  vite:config       [Object], [Object], [Object]
  vite:config     ],
  vite:config     rollupOptions: {}
  vite:config   }
  vite:config } +2ms
vite v2.8.6 building for production...
✓ 5 modules transformed.
[vite]: Rollup failed to resolve import "/public/fav%20icon.ico" from "src/App.vue".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
error during build:
Error: [vite]: Rollup failed to resolve import "/public/fav%20icon.ico" from "src/App.vue".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
    at onRollupWarning (/home/projects/vitejs-vite-o8aged/node_modules/vite/dist/node/chunks/dep-9c153816.js:39242:19)
    at onwarn (/home/projects/vitejs-vite-o8aged/node_modules/vite/dist/node/chunks/dep-9c153816.js:39020:13)
    at Object.eval [as onwarn] (/home/projects/vitejs-vite-o8aged/node_modules/rollup/dist/shared/rollup.js:23129:13)
    at ModuleLoader.handleResolveId (/home/projects/vitejs-vite-o8aged/node_modules/rollup/dist/shared/rollup.js:22419:26)
    at eval (/home/projects/vitejs-vite-o8aged/node_modules/rollup/dist/shared/rollup.js:22380:26)
[!] Error: unfinished hook action(s) on exit:
(vite:load-fallback) load "/home/projects/vitejs-vite-o8aged/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js"


### Validations

- [X] Follow our [Code of Conduct](https://github.com/vitejs/vite/blob/main/CODE_OF_CONDUCT.md)
- [X] Read the [Contributing Guidelines](https://github.com/vitejs/vite/blob/main/CONTRIBUTING.md).
- [X] Read the [docs](https://vitejs.dev/guide).
- [X] Check that there isn't [already an issue](https://github.com/vitejs/vite/issues) that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/core instead.
- [X] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/vitejs/vite/discussions) or join our [Discord Chat Server](https://chat.vitejs.dev/).
- [X] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.
@patak-dev
Copy link
Member

It seems this is an issue that only happens in Vue, moving the issue to vite-plugin-vue.

But from what I gather, the SFC compiler is encoding the space as part of moving the img src to an import transformAssetUrls

There is an open PR here (this issue is also affecting VitePress)

I don't know if the PR is correct though, or if vite-plugin-vue would deal with this. I would expect this needs to be fixed in Vue.

@patak-dev patak-dev added bug: upstream Bug in a dependency of this repository p3-minor-bug 🔨 An edge case that only affects very specific usage (priority) and removed pending triage labels Aug 1, 2023
@edison1105
Copy link
Member

Closing as it can't reproduce with:

  "dependencies": {
    "vue": "3.5.8"
  },
  "devDependencies": {
    "@vitejs/plugin-vue": "5.1.4",
    "vite": "5.4.7"
  }

@edison1105 edison1105 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 25, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Oct 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug: upstream Bug in a dependency of this repository 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.

4 participants