-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathwebpack.config.js
56 lines (55 loc) · 1.28 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
var webpack = require('webpack');
var path = require('path');
var uglifyjs = require('uglifyjs-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const entry = {
home: path.join(__dirname, 'public/page/home.js'),
}
module.exports = {
entry: entry,
output: {
filename: '[name].min.js',
path: path.join(__dirname, '/assets'),
publicPath: 'http://localhost:4444/assets/',
},
module: {
rules: [
{ test: /\.css$/, use: ["css-loader", "style-loader"] },
{ test: /\.less$/, use: ["css-loader", "style-loader", "less-loader"] },
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader', 'sass-loader']
})
},
{
test: /\.js$/,
loader: "babel-loader",
query: {
presets: [
require.resolve('babel-preset-stage-0'),
require.resolve('babel-preset-react'),
require.resolve('babel-preset-es2015'),
]
}
},
{ test:/\.(png|jpg|jpeg)$/, use: ["file-loader", "image-webpack-loader", {
loader: "url-loader",
options: {
limit: 8142,
name: 'images/[name].[ext]',
}
}] }
]
},
devServer: {
port: 4444,
},
plugins: [
new ExtractTextPlugin('[name].min.css'),
new uglifyjs({
sourceMap: true
})
],
};