Webpack VueJS CLI网页包静态文件夹在子文件夹中时不工作

Webpack VueJS CLI网页包静态文件夹在子文件夹中时不工作,webpack,vuejs2,vue-cli,Webpack,Vuejs2,Vue Cli,我正在使用vuejs cli网页包模板。 我的URL无法正常工作,例如: <link rel="..." href="/static/img/favicons/apple-icon-57x57.png"> (main.js),url不工作。(找不到404文件) 我已经更改了webpack选项:AssetPublicPath Webpack config/index.js文件: build: { // Template for index.html index:

我正在使用vuejs cli网页包模板。 我的URL无法正常工作,例如:

<link rel="..." href="/static/img/favicons/apple-icon-57x57.png">
(main.js),url不工作。(找不到404文件)

我已经更改了webpack选项:AssetPublicPath

Webpack config/index.js文件:

  build: {
    // Template for index.html
    index: path.resolve(__dirname, '../dist/index.html'),

    // Paths
    assetsRoot: path.resolve(__dirname, '../dist'),
    assetsSubDirectory: 'static',
AssetPublicPath:“/vueapp/dist/”

生产服务器:
开发服务器:


提前感谢=)

设置
assets子目录:'./static'
。发生这种情况是因为您没有将应用程序放置在web根目录中,而模板假定该根目录为web根目录。另一种解决方案是将
vueapp/dist
设置为Apache/Nginx配置中的web根目录。

assets子目录:'./static'
。发生这种情况是因为您没有将应用程序放置在web根目录中,而模板假定该根目录为web根目录。另一个解决方案是将
vueapp/dist
设置为Apache/Nginx配置中的web根目录。啊,好的,非常感谢:)
  build: {
    // Template for index.html
    index: path.resolve(__dirname, '../dist/index.html'),

    // Paths
    assetsRoot: path.resolve(__dirname, '../dist'),
    assetsSubDirectory: 'static',
    ...