5 Star 29 Fork 9

chuchur/kui-vue

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
vue.config.js 3.60 KB
一键复制 编辑 原始数据 按行查看 历史
chuchur 提交于 2024-05-29 14:23 . v3.3.12:
// 遗弃 !!!
const { defineConfig } = require('@vue/cli-service')
const webpack = require('webpack');
const path = require('path');
let { NODE_ENV, npm_package_version, npm_package_name, npm_lifecycle_event } = process.env
// const TerserPlugin = require('terser-webpack-plugin');
module.exports = defineConfig({
transpileDependencies: true,
lintOnSave: false, // no check
productionSourceMap: false, //no .map
devServer: {
port: 7005,
host: 'localhost',
hot: true,
},
configureWebpack: {
// optimization: {
// runtimeChunk: 'single',
// splitChunks: true,
// },
// externals: {
// 'lodash': {
// commonjs: 'lodash',
// amd: 'lodash',
// root: '_'
// }
// },
// pages: {
// },
// plugins: [
// new webpack.optimize.LimitChunkCountPlugin({
// maxChunks: 5,
// }),
// new MiniCssExtractPlugin({ filename: 'k-ui.css' }),
// ],
// entry: {
// 'kui': '/components/bin/index.js'
// },
// ],
devtool: 'eval',
resolve: {
alias: {
'@': '/src',
'kui-vue': '/components',
}
}
},
chainWebpack: (config) => {
config.optimization.runtimeChunk = 'single'
const isProduction = NODE_ENV === 'production';
if (!isProduction || npm_lifecycle_event == 'builddocs') {
config.module.rule('md')
.test(/\.md$/)
.use('vue-loader')
.loader('vue-loader')
.end()
.use('md-loader')
.loader('./src/utils/md-loader')
.options()
.end()
.use('kui-loader')
.loader('kui-loader')
.options({ prefix: false })
.end()
}
// banner
config.plugin('banner').use(webpack.BannerPlugin, [{
banner: `${npm_package_name} v${npm_package_version}\nCopyright 2017-present, kui-vue.\nAll rights reserved.\nAuthor: chuchur@qq.com / www.chuchur.com`,
raw: false,
entryOnly: !isProduction
}]);
// build lang
if (npm_lifecycle_event == 'buildlib') {
// config.entryPoints.delete('app')
// config.optimization.splitChunks(false);
config.entryPoints.clear();
config.entry('k-ui').add(`./components/bin/index.js`).end()
config.output.library('kui')
.filename("k-ui.js")
.libraryExport('default')
.libraryTarget('umd') //--formats
.umdNamedDefine(true)
.globalObject('this')
config.plugins.delete('demo-html')
} else if (npm_lifecycle_event == 'buildlang') {
/**
* fuck ,why can't build mult lib ?
* at \@vue\cli-service\lib\commands\build\resolveLibConfig.js
* remove line 113 - 115 at :rawConfig.entry = { ... }
* remove line 120 at: libraryTarget: format,
* remove line 127 at:filename: `${entryName}.js`,
* */
config.entryPoints.clear();
['de', 'el', 'en', 'fr', 'it', 'ja', 'ko', 'ru', 'th', 'ua', 'vi', 'zh-CN', 'zh-TW'].forEach(lang => {
config.entry(lang.replace('-', '')).add(`./components/locale/lang/${lang}.js`).end()
});
config.output
// .filename("[name].js")
.library("kui_lang_[name]")
.libraryTarget("assign") //assign-properties
.umdNamedDefine(true)
} else {
// config.resolve.alias
// .set('@', '/src')
// .set('kui-vue', '/components')
}
// config.optimization.minimizer('terser').tap((args) => {
// Object.assign(args[0].terserOptions.compress, {
// warnings: false, //默认false
// drop_console: true,
// drop_debugger: true, //默认true
// pure_funcs: ['console.log']
// })
// return args
// })
},
})
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/chuchur/kui-vue.git
git@gitee.com:chuchur/kui-vue.git
chuchur
kui-vue
kui-vue
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385