-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.publish.js
executable file
·45 lines (44 loc) · 1.21 KB
/
webpack.publish.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
const path = require('path');
const webpack = require('webpack');
const CleanWebpackPlugin = require('clean-webpack-plugin');//构建时清理
const autoprefixer = require('autoprefixer');//补全css各种hack
module.exports = {
devtool: "source map",
entry: {
plugin: './src/js/plugin.js'
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'lib')
},
module: {
rules: [
{
test: /\.scss/i,
use: ['style-loader','css-loader', 'sass-loader','autoprefixer-loader']
},
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: [
"babel-preset-es2015"
]
}
}
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/,
use: [
'file-loader?name=font/[hash:8].[ext]'
]
}
]
},
plugins: [
//清理lib
new CleanWebpackPlugin(['lib']),
]
};