Vuejs 生产构建 - 如何将生成的“img”文件夹名称更改为“images”

mar*_*val 2 vue.js

在我的 vue-cli3 项目中,当我运行构建命令时,我会得到通常的 index.html + 3 个文件夹(css、js、img)。

是否可以以某种方式将 img 文件夹的名称更改为“images”?

我想我必须在 vue.config.js 中添加一些内容来指示 webpack,但我找不到任何相关信息。

感谢您的指点。

mar*_*val 5

根据 @Emin Me\xc5\xa1i\xc4\x87 我能够通过将其添加到我的 vue.config.js 来实现这一点

\n\n
chainWebpack: config => {\n  config.module.rule('images').use('url-loader')\n    .loader('file-loader') // replaces the url-loader\n    .tap(options => Object.assign(options, {\n      name: 'images/[name].[hash:8].[ext]'\n    }))\n  config.module.rule('svg').use('file-loader')\n    .tap(options => Object.assign(options, {\n      name: 'images/[name].[hash:8].[ext]'\n    }))\n  },\n
Run Code Online (Sandbox Code Playgroud)\n