Files
hoc-element-affix/build/webpack.config.js

129 lines
2.7 KiB
JavaScript
Raw Normal View History

2020-04-03 16:34:17 +08:00
const path = require('path')
const webpack = require('webpack')
const { VueLoaderPlugin } = require('vue-loader')
2022-01-01 16:14:33 +08:00
const { resolve } = require('./utils')
2020-04-03 16:34:17 +08:00
module.exports = {
mode: 'production',
entry: './src/main.js',
output: {
2020-10-06 17:03:32 +08:00
path: resolve('./lib'),
2020-04-03 16:34:17 +08:00
publicPath: '/lib/',
filename: 'hoc-el-affix.js',
libraryTarget: 'umd'
},
2022-01-01 16:14:33 +08:00
stats: 'minimal',
2020-04-03 16:34:17 +08:00
module: {
rules: [
{
test: /\.css$/,
use: [
'vue-style-loader',
'css-loader'
]
},
{
test: /\.scss$/,
use: [
'vue-style-loader',
'css-loader',
'sass-loader'
]
},
{
test: /\.sass$/,
use: [
'vue-style-loader',
'css-loader',
'sass-loader?indentedSyntax'
]
},
{
test: /\.vue$/,
use: {
loader: 'vue-loader'
},
exclude: /node_modules/,
2022-01-01 16:14:33 +08:00
include: resolve('./src')
2020-04-03 16:34:17 +08:00
},
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
2022-01-01 16:14:33 +08:00
extends: resolve('./babel.config.js')
2020-04-03 16:34:17 +08:00
}
}
},
{
2022-01-01 16:14:33 +08:00
test: /\.(png|jpe?g|gif|svg|webp)(\?.*)?$/,
loader: 'url-loader',
exclude: /node_modules/,
options: {
limit: 10000,
esModule: false,
name: '[name].[hash:7].[ext]'
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader',
exclude: /node_modules/,
options: {
limit: 10000,
name: '[name].[hash:7].[ext]'
}
},
{
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
loader: 'url-loader',
exclude: /node_modules/,
options: {
limit: 10000,
name: '[name].[hash:7].[ext]'
}
},
{
test: /\.(png|jpe?g|gif|svg|webp|woff2?|eot|ttf|otf|mp4|webm|ogg|mp3|wav|flac|aac)(\?\S*)?$/,
2020-04-03 16:34:17 +08:00
loader: 'file-loader',
2022-01-01 16:14:33 +08:00
include: /node_modules/,
2020-04-03 16:34:17 +08:00
options: {
name: '[name].[ext]?[hash]'
}
}
]
},
resolve: {
alias: {
2022-01-01 16:14:33 +08:00
vue$: 'vue/dist/vue.esm-bundler.js',
'@': resolve('./src')
2020-04-03 16:34:17 +08:00
},
extensions: ['*', '.js', '.vue', '.json']
},
devServer: {
historyApiFallback: true,
disableHostCheck: true,
inline: false,
overlay: true,
quiet: true
},
performance: {
hints: false
},
devtool: 'source-map',
2022-01-01 16:14:33 +08:00
externals: {
vue: {
root: 'Vue',
commonjs: 'vue',
commonjs2: 'vue'
}
},
2020-04-03 16:34:17 +08:00
plugins: [
new VueLoaderPlugin(),
new webpack.LoaderOptionsPlugin({
minimize: true
}),
]
}