Comments (2)
This is a Vite question.
I think it's because the address resolution isn't working.
In general, the front end cannot scan files in a specific directory on the server. If you're thinking of implementing a script that updates the file list in the directory on the frontend side, using import.meta.glob
is not the right solution. It is common to prepare a backend program that outputs a list of files in a directory and obtain it with axios
or Fetch API.
from vite-vuetify-ts-starter.
I did figure it out, Vite needs to resolve paths for static assets from absolute paths so in my case I had to remove the base
from vite.config.js
and adapt my code to produce an absolute path which looks something like :
(Object.values(import.meta.glob("../assets/ss_content/tu_et_moi/*.{jpg,png,gif}", { eager: true }))).forEach(
({ default: path }: any) => {
const url = new URL(path, import.meta.url);
const data = {
src: url.pathname,
alt: 'Alt_' + path
};
tuEtMoiImages.push(data);
}
);
from vite-vuetify-ts-starter.
Related Issues (14)
- I use your starter to develope but it always stop running during hmr HOT 2
- Content Security Policy setting HOT 2
- Running on Windows and node 18.12.1 is very slow HOT 6
- Unit tests do not work HOT 5
- Loading overlay blocks browser navigation buttons HOT 5
- Performance Issues and Vuetify Plugin Problems in Your Project HOT 1
- improve performance and reduce build size HOT 2
- import colors from vuetify/lib/util/colors HOT 1
- tsconfig HOT 5
- husky precommit HOT 21
- type declaration HOT 2
- eslint | public files imports HOT 2
- Editing markdown throws Eslint errors [ESLint] Parsing error: Invalid character. (null) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vite-vuetify-ts-starter.