-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.test.babel.js
57 lines (56 loc) · 1.52 KB
/
webpack.config.test.babel.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
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextWebpackPlugin = require('extract-text-webpack-plugin');
var path = require('path');
module.exports = {
entry: {
app: './test/index.js'
},
output:{
path: path.resolve(__dirname, 'test'),
filename: '[name].js',
publicPath: '/',
},
module:{
rules: [
{
test: /\.css$/ ,
use: ExtractTextWebpackPlugin.extract({
fallback: 'style-loader',
use: 'css-loader',
publicPath: '/dist'
})
},
{
test: /\.js$/,
exclude: /node_modules/,
use: 'babel-loader'
},
{
test: /\.(jpg|png|gif)$/,
use: 'file-loader?name=/images/[name].[ext]'
},
{
test: /\.(svg|woff2|ttf|woff|eot)$/,
use: 'file-loader?name=/fonts/[name].[ext]'
},
{ test: /\.less$/, loader: "style-loader!css-loader!less-loader"}
]
},
//配置开发webpack-dev-server
devServer: {
compress: true,
stats: 'errors-only',
open: true
},
plugins:[
new HtmlWebpackPlugin({
template: 'test/index.html',
inject: true,
hash: true
}),
new ExtractTextWebpackPlugin({
filename: '[name].css',
allChunks: true
})
]
};