【问题标题】:Wrong path to static files in production mode in Vue.js applicationVue.js 应用程序中生产模式下静态文件的路径错误
【发布时间】:2018-01-06 09:43:57
【问题描述】:

我使用 Vue.js 创建了一个应用程序并运行 npm run build。完成进程后出现dist 文件夹,但静态文件的路径错误。它在每条路径之前添加'/'。像这样:<script type="text/javascript" src="/static/js/app.5563dab9fc515679fa52.js"></script>。 但这是错误的。 static 文件夹之前必须没有正斜杠。

在开发模式下src 中的文件结构如下:

在这样的生产模式下:

【问题讨论】:

    标签: javascript vuejs2 production


    【解决方案1】:

    已解决: 我刚刚更改了config 文件夹中的index.js 文件。

    发件人: assetsPublicPath: '/'

    收件人: assetsPublicPath: ''

    【讨论】:

      猜你喜欢
      • 2018-05-20
      • 1970-01-01
      • 1970-01-01
      • 2011-06-23
      • 2016-06-24
      • 2017-12-31
      • 2020-12-07
      • 2020-04-30
      • 1970-01-01
      相关资源
      最近更新 更多