question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

library mode can't extract static assets

See original GitHub issue

Describe the bug

while in library mode, exec yarn build, the static assets is inline into css file, but what i want is to remain assets alone.

Reproduction

  1. yarn create @vitejs/app vite-demo --template react
  2. replace img with div in App.tsx, and remove src attribute
<div className="App-logo" />
  1. add background-image: url(facivon.svg) for .App-logo classname in App.css
.App-logo {
	height: 40vmin;
	pointer-events: none;
	background-image: url(t.jpeg);
}
  1. edit vite.config.json
import { defineConfig } from 'vite';
import path from 'path';
import reactRefresh from '@vitejs/plugin-react-refresh';

// https://vitejs.dev/config/
export default defineConfig({
	plugins: [reactRefresh()],
	build: {
		assetsInlineLimit: 0,
		lib: {
			entry: path.resolve(__dirname, './src/main.tsx'),
			name: 'demo',
		},
	},
});

  1. exec yarn build

  2. output

dist
├── style.css
├── vite-demo.es.js
└── vite-demo.umd.js

what i expect is that there is a favicon.svg file in dist directory

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:20
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

13reactions
cj1128commented, Jul 9, 2021

Any updates?

Can we have an option that enables emitting assets separately in lib mode?

9reactions
ivan-palatovcommented, Oct 17, 2022

Any updates on this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Static Asset Handling - Vite
Explicit URL Imports​​ Assets that are not included in the internal list or in assetsInclude , can be explicitly imported as a URL...
Read more >
Django cannot find static files. Need a second pair of eyes, I'm ...
If you are in DEBUG, set STATICFILES_DIRS = ("path/to/static") variable in your settings.py. It should then work only in DEBUG mode. If you...
Read more >
Recover static library from executable - Unix Stack Exchange
I'd like to pull missingFunction1() and missingFunction2() out into a static library or object files so I can link against them in other ......
Read more >
How to manage static files (e.g. images, JavaScript, CSS)
See the documentation for the STATICFILES_FINDERS setting for details on how staticfiles finds your files. Static file namespacing. Now we might be able...
Read more >
Managing a Library | Microsoft Learn
LIB runs in this mode when you don't specify /EXTRACT (to copy an ... LIB can't accept a 32-bit OMF object that's in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found