forked from luminati-io/luminati-proxy
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwebpack.config.js
executable file
·81 lines (81 loc) · 2.89 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
// LICENSE_CODE ZON ISC
'use strict'; /*jslint node:true*/
const webpack = require('webpack');
const html_webpack_plugin = require('html-webpack-plugin');
module.exports = {
context: `${__dirname}/src/pub`,
devServer: {
inline: true
},
entry: {
app: './app.js',
vendor: ['jquery', 'lodash', 'moment',
'bootstrap', 'bootstrap/dist/css/bootstrap.css',
'codemirror/lib/codemirror', 'codemirror/lib/codemirror.css',
'codemirror/mode/javascript/javascript',
'react', 'react-dom', 'react-bootstrap',
'regenerator-runtime', 'es6-shim', 'animate.css']
},
output: {
path: `${__dirname}/bin/pub`,
publicPath: '/',
filename: '[chunkhash].[name].js',
},
plugins: [
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
new webpack.optimize.CommonsChunkPlugin({
names: ['vendor', 'runtime'],
minChunks: Infinity,
}),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
}),
new html_webpack_plugin({inject: true, template: 'index.html'}),
],
module: {
rules: [
{
test: /src[\\\/]pub[\\\/].+\.js$/,
exclude: /node_modules/,
use: ['babel-loader'],
},
{
test: /www[\\\/].+\.js$/,
exclude: /node_modules/,
use: ['hutil-loader', 'babel-loader'],
},
{
test: /util[\\\/].+\.js$/,
parser: {node: false, commonjs: false},
exclude: [/www[\\\/].+\.js$/, /node_modules/],
use: ['hutil-loader'],
},
{test: /\.css$/, use: ['style-loader', 'css-loader']},
{test: /\.less$/, use: ['style-loader', 'css-loader?-url',
'less-loader']},
{test: /\.eot(\?v=\d+.\d+.\d+)?$/,
use: 'url-loader?limit=100000&name=[name].[ext]'},
{test: /\.woff2?(\?v=[0-9]\.[0-9]\.[0-9])?$/, use: 'url-loader?'
+'limit=100000&mimetype=application/font-woff&'
+'name=[name].[ext]'},
{test: /\.[ot]tf(\?v=\d+.\d+.\d+)?$/, use: 'url-loader?'
+'limit=100000&mimetype=application/octet-stream'},
{test: /\.svg(\?v=\d+.\d+.\d+)?$/, use: 'url-loader?'
+'limit=120000&mimetype=image/svg+xml&name=[name].[ext]'},
{test: /\.(jpe?g|png|ico|gif)$/, use: 'url-loader?limit=100000'},
],
},
resolve: {
modules: [__dirname, 'node_modules'],
alias: {
'/util': 'util/',
jquery: 'jquery/src/jquery.js',
virt_jquery_all: 'jquery/src/jquery.js',
'/www': 'www/',
},
},
resolveLoader: {
alias: {'hutil-loader': `${__dirname}/lib/hutil-loader.js`},
},
};