加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
webpack.config.js 1.81 KB
一键复制 编辑 原始数据 按行查看 历史
SevenOutman 提交于 2018-04-13 18:56 . Merge tag '1.4.3' into develop
var path = require('path')
var webpack = require('webpack')
module.exports = {
entry: './src/vue-aplayer.vue',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'vue-aplayer.min.js',
library: 'VueAPlayer',
libraryTarget: 'umd'
},
externals: {
'hls.js': {
amd: 'hls.js',
commonjs: 'hls.js',
commonjs2: 'hls.js',
root: 'Hls'
},
'vue': {
amd: 'vue',
commonjs: 'vue',
commonjs2: 'vue',
root: 'Vue'
},
},
module: {
rules: [
{
test: /\.(js|vue)$/,
loader: 'eslint-loader',
enforce: 'pre',
include: [path.resolve(__dirname, 'src')],
options: {
formatter: require('eslint-friendly-formatter'),
emitWarning: true
}
},
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
scss: 'vue-style-loader!css-loader?minimize=true!postcss-loader!sass-loader'
},
}
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
},
{
test: /\.(png|jpg)$/,
loader: 'url-loader?limit=40000'
},
{
test: /\.svg$/,
loader: 'svg-inline-loader'
},
{
test: /\.html$/,
loader: 'vue-html-loader'
}
]
},
devtool: '#source-map',
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: `"${process.env.NODE_ENV}"`
},
VERSION: JSON.stringify(require('./package.json').version)
}),
]
}
if (process.env.NODE_ENV === 'production') {
// http://vuejs.github.io/vue-loader/workflow/production.html
module.exports.plugins.push(
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
})
)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化