module.exports = {
outputDir: 'lib',
productionSourceMap: false,
configureWebpack: config => {
let getConfig = config;
getConfig = Object.assign(getConfig, {
entry: process.env.NODE_ENV == 'development' ? './src/main.ts' : './src/plugin/index.ts',
output: {
...getConfig.output,
filename: 'Impzipper.js',
library: 'Impzipper',
libraryTarget: 'umd',
},
});
},
// 选项...
}
这是打包出来后的内容
我在vue.config.js这样写,然后index.ts只export一个纯js的方法,为什么build出来会有html文件,请问怎样只打包出单个js文件,就是只有一个impzipper的文件?
不能,vuecli不是为了构建js lib设计的。而是web应用构建,所以vuecli自带的webpack config是一定会有html-webpack-plugin的。
你可以自己配置webpack 或者使用配置更加简单的rollup/gulp