The Bug
While bunldling a Vanilla JS project with image assets, using
npm run build
, there was one image that was not being bundled.The image that was not being bundled was the last image to be pasted into my project
I have imported all images in the same way, using
import ... from "filename.png"
syntax in one file.This is the output of
npm run build
NOTE Clearly,ash.png
is not included, whereasplayer.png
in the same folder is included. Both are imported in the same file in the same way as shown above.
❯ npm run build
> clean-rpg@0.0.0 build D:\Sattwik\code\web\js\game-dev\clean-rpg
> tsc && vite build
vite v2.5.6 building for production...
✓ 22 modules transformed.
dist/assets/favicon.17e50649.svg 1.49 KiB
dist/assets/room-builder.325bbcfc.png 20.98 KiB
dist/assets/things.5fe02e3d.png 27.07 KiB
dist/assets/player.c5281145.png 7.15 KiB
dist/assets/ground.8651476d.png 69.11 KiB
dist/assets/interior.294e2488.png 203.12 KiB
dist/index.html 0.78 KiB
dist/assets/index.cc5b3aa7.css 2.35 KiB / brotli: 1.40 KiB
dist/assets/index.f94427a3.js 137.68 KiB / brotli: 8.73 KiB
dist/assets/vendor.354f1e58.js 1305.08 KiB / brotli: skipped (large chunk)
(!) Some chunks are larger than 500 KiB after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/guide/en/#outputmanualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
- On starting the dev server with
npm run dev
, all the images load and everything works - But after building and previewing with
npm run serve
,ash.png
does not load and a warningvendor.354f1e58.js:105 Local data URIs are not supported: ash-spritesheet
is displayed in the console
Reproduction
Please refer to the repository here, containing all files and assets as is
- Run the dev server with
npm run dev
and the project should work (the game should load with both images -player.png
andash.png
) - Preview with
npm run build
thennpm run serve
and reproduce the bug
System Info
❯ npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers
npx: installed 1 in 6.14s
System:
OS: Windows 7 6.1.7601
CPU: (2) x64 Pentium(R) Dual-Core CPU E5300 @ 2.60GHz
Memory: 1.10 GB / 2.99 GB
Binaries:
Node: 12.21.0 - C:\Program Files\nodejs\node.EXE
npm: 6.14.11 - C:\Program Files\nodejs\npm.CMD
Browsers:
Internet Explorer: 8.0.7601.17514
npmPackages:
vite: ^2.5.4 => 2.5.6
Used Package Manager
npm
Logs
❯ npx vite build --debug
vite:config no config file found. +0ms
vite:config using resolved config: {
vite:config root: 'D:/Sattwik/code/web/js/game-dev/clean-rpg',
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', '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 sourcemap: false,
vite:config rollupOptions: {},
vite:config commonjsOptions: { include: [Array], extensions: [Array] },
vite:config dynamicImportVarsOptions: { warnOnError: true, exclude: [Array] },
vite:config minify: 'terser',
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 brotliSize: true,
vite:config chunkSizeWarningLimit: 500,
vite:config watch: null
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 build: {}
vite:config },
vite:config resolve: { dedupe: undefined, alias: [ [Object], [Object] ] },
vite:config publicDir: 'D:\\Sattwik\\code\\web\\js\\game-dev\\clean-rpg\\public',
vite:config cacheDir: 'D:\\Sattwik\\code\\web\\js\\game-dev\\clean-rpg\\node_modules\\.vite',
vite:config command: 'build',
vite:config isProduction: true,
vite:config plugins: [
vite:config 'alias',
vite:config 'vite:modulepreload-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 'asset-import-meta-url',
vite:config 'vite:import-analysis',
vite:config 'vite:esbuild-transpile',
vite:config 'vite:terser',
vite:config 'vite:reporter',
vite:config 'load-fallback'
vite:config ],
vite:config server: { fs: { strict: undefined, allow: [Array] } },
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 createResolver: [Function: createResolver],
vite:config optimizeDeps: { esbuildOptions: { keepNames: undefined } }
vite:config } +46ms
vite v2.5.6 building for production...
transforming (1) index.html vite:resolve 0ms ./assets/ui/msg-box.png -> D:/Sattwik/code/web/js/game-dev/clean-rpg/src/assets/ui/msg-box.png +0ms
✓ 22 modules transformed.
dist/assets/favicon.17e50649.svg 1.49 KiB
dist/assets/player.c5281145.png 7.15 KiB
dist/assets/room-builder.325bbcfc.png 20.98 KiB
dist/assets/things.5fe02e3d.png 27.07 KiB
dist/assets/ground.8651476d.png 69.11 KiB
dist/assets/interior.294e2488.png 203.12 KiB
dist/index.html 0.78 KiB
dist/assets/index.cc5b3aa7.css 2.35 KiB / brotli: 1.40 KiB
dist/assets/index.f94427a3.js 137.68 KiB / brotli: 8.73 KiB
dist/assets/vendor.354f1e58.js 1305.08 KiB / brotli: skipped (large chunk)
(!) Some chunks are larger than 500 KiB after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/guide/en/#outputmanualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
GitHub Issues
This question has been raised as a Github issue