Closed Caiyeon closed 7 years ago
hello @Caiyeon
I can't reproduce your problem . show your development environment
I am running npm build
to generate the built files, and then serving the entire generated folder with Golang Echo framework echo.Static("/", "public")
. I can reproduce this on Windows, OSX, and Debian
Here's what it looks like:
And chrome dev panel provides these errors:
Mousing over the asset displays what the server is trying to serve the ttf file from:
But as you know, the ttf files are not generated in assets/css/assets/fonts
, they are generated in assets/fonts
it looks like this problem caused by your static server .
try with npm run start
after npm run build
@netpi start
isn't a provided script in package.json
Can you provide the command that it maps to?
@Caiyeon Sorry I forget npm run start
have not yet configured
npm install -g node-static
cd dist && static
It's still trying to serve fonts from /assets/css/assets/fonts/
@netpi This is on Windows 10, but it seems that the behaviour is independent of the server
Fixed it. It seems I was missing this: https://github.com/vue-bulma/vue-admin/commit/6352f760af087f6e180f9495e4eb64f415716228#diff-b837e8e89bbf621827a64e0b2b0c0aa5
I had publicPath: isELECTRON ? path.join(__dirname, '../dist/') : '',
in my repo instead of
publicPath: isELECTRON ? path.join(__dirname, '../dist/') : '/',
Sorry for the inconvenience @netpi :)
😆 thank you @Caiyeon
Well, I meet the same problem as I set publicpath from isELECTRON ? path.join(__dirname, '../dist/') : '/' to isELECTRON ? path.join(__dirname, '../dist/') : './'. But my purpose is to change the absolute sourse request path (like /assets/js/) to relative path (like ./assets/js/) so that I can put all the files of vue-admin under /var/www/html/vue-admin/ instead of /var/www/html. So what files do I need to modify? Thanks.
@Caiyeon @netpi Hello, guys. Do you know how to deal with my problem?
After running
npm run build
, the fonts are generated underpublic/assets/fonts
However, when the webpage is served, the server tries to serve fonts frompublic/assets/css/assets/fonts
Changing
frontend/build/webpack.base.conf.js
query.name for font files will result in a change in both paths. In other words, changing query.name fromutils.assetsPath('fonts/[name].[hash:7].[ext]')
toutils.assetsPath('css/[name].[hash:7].[ext]')
will result in fonts generated atpublic/assets/css/fonts
and referenced atpublic/assets/css/assets/css
, and does not solve the problem.This issue does not occur when using
npm run dev