-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
webpack.config.js
92 lines (87 loc) · 1.86 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
const { merge } = require('webpack-merge')
const path = require('path')
const MiniCSSExtractPlugin = require('mini-css-extract-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const VueLoaderPlugin = require('vue-loader/lib/plugin')
function resolve (dir) {
return path.join(__dirname, dir)
}
let common = {
externals: [
'vue'
],
mode: 'development',
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
compilerOptions: {
preserveWhitespace: false
},
hotReload: false
}
},
{
test: /\.js$/,
loader: 'babel-loader',
include: __dirname,
exclude: file => (
/node_modules/.test(file) &&
!/\.vue\.js/.test(file)
)
},
{
test: /\.s?css$/,
loader:
[
MiniCSSExtractPlugin.loader,
'css-loader',
'sass-loader'
]
},
]
},
output: {
path: resolve('/dist')
},
plugins: [
new MiniCSSExtractPlugin({
filename: 'style/vue-sliding-pagination.css',
}),
new VueLoaderPlugin()
]
}
module.exports = [
// browser build
merge(common, {
mode: 'production',
entry: resolve('/src/plugin.js'),
output: {
filename: 'browser/vue-sliding-pagination.min.js',
},
}),
// node module build
merge(common, {
mode: 'production',
entry: resolve('/src/SlidingPagination.vue'),
output: {
filename: 'vue-sliding-pagination.umd.js',
libraryTarget: 'umd',
library: 'vue-sliding-pagination',
umdNamedDefine: true
},
plugins: [
new CopyWebpackPlugin({
patterns: [
{
from: './src/styles/*',
to: 'style/[name].[ext]',
toType: 'template'
}
]
}),
]
})
];