加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
webpack.component.js 934 Bytes
一键复制 编辑 原始数据 按行查看 历史
lilian 提交于 2022-10-19 22:08 . 解决图片资源打包问题
const glob = require("glob")
const { resolve } = require("path")
const { VueLoaderPlugin } = require("vue-loader")
const { CleanWebpackPlugin } = require("clean-webpack-plugin")
// 多入口配置
const entryList = {}
glob.sync("components/lib/**/index.js").forEach(file => {
let bundleName = file.split("/")[2]
if (bundleName === "index.js") {
bundleName = "index"
}
entryList[bundleName] = `./${file}`
})
module.exports = {
mode: "development",
entry: entryList,
output: {
path: resolve(__dirname, "./build"),
filename: "[name].js",
library: {
name: "mala",
type: "umd"
}
},
module: {
rules: [
{
test: /\.vue$/,
loader: "vue-loader"
},
{
test: /\.jpg|png|gif|bmp|ttf|eot|svg|woff|woff2$/,
type: 'asset/inline'
}
]
},
plugins: [
new VueLoaderPlugin(),
new CleanWebpackPlugin()
],
externals: ['vue']
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化