-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
88 lines (87 loc) · 2.7 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
require('es6-promise').polyfill();
var path = require('path');
var fs = require("fs");
var webpack = require('webpack');
module.exports = {
// devtool: 'inline-source-map',
entry: {
'content-script': './src/content/script.js',
'background': './src/background/background.js'
},
output: {
path: path.join(__dirname, "./build/"),
filename: '[name].js'
},
module: {
loaders: [{
test: /\.less$/,
loaders: ["style-loader", "css-loader", "less-loader"]
}, {
test: /\.css$/,
loaders: ["style-loader", "css-loader"]
}, {
test: /\.html$/,
loader: 'html'
}, {
test: /\.svg$/,
loader: 'url-loader?mimetype=image/svg+xml'
}, {
test: /\.(es6|hyper)$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel',
query: {
presets: ['es2015'],
plugins: ['transform-runtime'],
plugins: ['transform-async-to-generator']
}
}, {
test: /\.json$/,
loader: 'json-loader'
}, {
test: /\.(woff|woff2|ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'base64-font-loader'
}, {
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
loader: "url?limit=10000&mimetype=image/svg+xml"
}, {
test: /\.(png|jpg)$/,
loader: 'url-loader?limit=30000&name=[name]-[hash].[ext]'
}
]
},
resolve: {
root: [
path.resolve('./src'),
path.resolve('./node_modules')
],
/*.concat(fs.readdirSync("./node_modules")
.filter(function(f){return fs.statSync(path.join("./node_modules", f)).isDirectory()})
.map(function(f){return path.resolve(path.join("./node_modules", f, "node_modules"))})),*/
alias: {},
extensions: ['.es6', '', '.js', '.json', '.hyper']
},
resolveLoader: {
root: [
path.join(__dirname, "node_modules")
],
alias: {}
},
plugins: [
// new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(true),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"window.jQuery": "jquery",
_: "lodash",
lodash: "lodash",
Vue: "vue",
Cookie: "tiny-cookie"
})
// new webpack.optimize.UglifyJsPlugin({
// compress: {
// warnings: false
// }
// })
]
};