1 Star 0 Fork 467

mastergo/dootask

forked from aipaw/dootask 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
webpack.mix.js 1.46 KB
一键复制 编辑 原始数据 按行查看 历史
kuaifan 提交于 2021-07-09 19:03 . no message
const mix = require('laravel-mix');
const ipv4 = require('internal-ip').v4.sync();
const argv = process.argv;
let mixBuildName = function (str) {
if (typeof str !== "string") {
return str;
}
if (/resources_assets_js_pages_(.*?)_vue/.test(str)) {
str = /resources_assets_js_pages_(.*?)_vue/.exec(str)[1];
}
return str.replace(/_/g, '/');
}
let isHot = argv.includes('--hot');
let isElectron = argv.includes('--electron');
let publicPath = (!isHot && isElectron) ? 'electron/public' : 'public';
mix
.copy('resources/assets/statics/public', publicPath)
.js('resources/assets/js/app.js', 'js')
.sass('resources/assets/sass/app.scss', 'css')
.setPublicPath(publicPath)
.webpackConfig(webpack => {
let config = {
output: {
chunkFilename: ({chunk}) => {
return `js/build/${mixBuildName(chunk.id)}.js`
}
},
plugins: [
new webpack.DefinePlugin({
'__IS_ELECTRON': isElectron,
})
]
};
if (isElectron) {
config.target = 'electron-renderer'
if (!isHot) {
config.output.publicPath = './'
}
}
return config
})
.options({
processCssUrls: false,
hmrOptions: {
host: ipv4 || 'localhost',
port: '22222'
},
})
.vue({
version: 2,
});
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mer163/dootask.git
git@gitee.com:mer163/dootask.git
mer163
dootask
dootask
master

搜索帮助