Webpack之后不包含vue“公共”文件

时间:2020-06-29 16:56:15

标签: vue.js webpack

我的vue-js应用程序的public文件夹中有一组文件,我希望在构建项目时,根据这些信息,它们会被复制到wwwroot文件夹中在文档中:

放置在公用文件夹中的任何静态资产都将被简单复制,而不会通过webpack。您需要使用绝对路径引用它们。 (ref

文件是favicon.ico和其他各种大小的favicon png,以及site.webmanifest。除了使用提供的示例(据我所知)在index.html中引用它们之外,我没有在任何代码中引用它们:

<link rel="apple-touch-icon" sizes="180x180" href="<%= BASE_URL %>apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="<%= BASE_URL %>favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="<%= BASE_URL %>favicon-16x16.png">
<link rel="manifest" href="<%= BASE_URL %>site.webmanifest">

在构建时如何将它们复制到生成的网站的基础上?包括所有直接引用的资产(css,字体等),但public中的所有静态文件都没有,除了index.html本身。

作为参考,如果适用,这是我的vue.config.js:

const path = require("path");

module.exports = {
    outputDir: path.resolve(__dirname, "./wwwroot"),
    chainWebpack: (config) => {
        config
            .plugin('html')
            .tap((args) => {
                args[0].template = './ClientApp/public/index.html'
                return args
            })

        config.entry("app")
            .clear()
            .add("./ClientApp/src/main.js")
            .end()

        config.resolve.alias
            .set("@", path.join(__dirname, "./ClientApp"))
    }
}

我确定我正在忽略某些东西-感谢您的协助。

0 个答案:

没有答案
相关问题