Skip to content

publicPath属性设置无效 #7469

@jfornior

Description

@jfornior

Version

5.0.8

Environment info

  System:
    OS: Linux 5.10 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
    CPU: (16) x64 AMD Ryzen 7 5800H with Radeon Graphics
  Binaries:
    Node: 16.17.0 - ~/.nvm/versions/node/v16.17.0/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v16.17.0/bin/yarn
    npm: 8.15.0 - ~/.nvm/versions/node/v16.17.0/bin/npm
  Browsers:
    Chrome: Not Found
  npmPackages:
    @vue/babel-helper-vue-jsx-merge-props:  1.4.0 
    @vue/babel-helper-vue-transform-on:  1.2.5 
    @vue/babel-plugin-jsx:  1.2.5 
    @vue/babel-plugin-resolve-type:  1.2.5 
    @vue/babel-plugin-transform-vue-jsx:  1.4.0 
    @vue/babel-preset-app:  5.0.8 
    @vue/babel-preset-jsx:  1.4.0 
    @vue/babel-sugar-composition-api-inject-h:  1.4.0 
    @vue/babel-sugar-composition-api-render-instance:  1.4.0 
    @vue/babel-sugar-functional-vue:  1.4.0 
    @vue/babel-sugar-inject-h:  1.4.0 
    @vue/babel-sugar-v-model:  1.4.0 
    @vue/babel-sugar-v-on:  1.4.0 
    @vue/cli-overlay:  5.0.8 
    @vue/cli-plugin-babel: ~5.0.0 => 5.0.8 
    @vue/cli-plugin-eslint: ~5.0.0 => 5.0.8 
    @vue/cli-plugin-router:  5.0.8 
    @vue/cli-plugin-vuex:  5.0.8 
    @vue/cli-service: ~5.0.0 => 5.0.8 
    @vue/cli-shared-utils:  5.0.8 (4.5.19)
    @vue/compiler-core:  3.5.13 
    @vue/compiler-dom:  3.5.13 
    @vue/compiler-sfc:  3.5.13 (2.7.16)
    @vue/compiler-ssr:  3.5.13 
    @vue/component-compiler-utils:  3.3.0 
    @vue/shared:  3.5.13 
    @vue/web-component-wrapper:  1.3.0 
    babel-helper-vue-jsx-merge-props:  2.0.3 
    eslint-plugin-vue: ^8.0.3 => 8.7.1 
    vue: ^2.6.14 => 2.7.16 
    vue-cli-plugin-electron-builder: ~2.1.1 => 2.1.1 
    vue-eslint-parser:  8.3.0 
    vue-hot-reload-api:  2.3.4 
    vue-loader:  17.4.2 (15.11.1)
    vue-router: ^3.1.6 => 3.6.5 
    vue-style-loader:  4.1.3 
    vue-template-compiler: ^2.6.14 => 2.7.16 
    vue-template-es2015-compiler:  1.9.1 
    vuecli-publicpath-webpack-plugin: ^0.0.2 => 0.0.2 
    vuedraggable: ^2.24.3 => 2.24.3 
    vuex: ^3.1.3 => 3.6.2 
    vuex-persistedstate: ^4.1.0 => 4.1.0 
  npmGlobalPackages:
    @vue/cli: Not Found

Steps to reproduce

module.exports = {
publicPath: process.env.NODE_ENV === 'production' ? '././' : '/'
}
electron+vue项目中配置了publicPath属性
在css中设置背景图片时使用 background: url('../../assets/img/login-logo.jpg') no-repeat; 打包后运行的图片地址是url(app:///img/login-bg.00552e69.png),导致找不到该文件
并且element-ui的图标也无法使用

What is expected?

打包后的图片地址为url(app:/./img/login-bg.00552e69.png)
element-ui的图标字体能正常使用

What is actually happening?

Failed to read /login-logo.e0912caf.jpg on app protocol Error: ENOENT, login-logo.e0912caf.jpg not found in /opt/my-electron-demo/dist_electron/linux-unpacked/resources/app.asar
Failed to read /element-icons.f1a45d74.ttf on app protocol Error: ENOENT, element-icons.f1a45d74.ttf not found in /opt/my-electron-demo/dist_electron/linux-unpacked/resources/app.asar

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions