-
Notifications
You must be signed in to change notification settings - Fork 88
/
webpack.config.js
93 lines (89 loc) · 3.15 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
89
90
91
92
93
const path = require('path');
const webpack = require('webpack');
const node_path = path.join(__dirname, 'node_modules');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const css_loader = ExtractTextPlugin.extract('vue-style?sourceMap', 'css?sourceMap');
const less_loader = ExtractTextPlugin.extract('vue-style?sourceMap', 'css?sourceMap!less?sourceMap=source-map-less-inline');
const languages = ['en', 'es', 'fr', 'pt', 'sr', 'de'];
const public_path = '/static/';
module.exports = {
entry: {
admin: './js/admin.js',
},
output: {
path: path.join(__dirname, 'udata', 'static'),
publicPath: public_path,
filename: '[name].js',
chunkFilename: 'chunks/[id].[chunkhash].js'
},
resolve: {
root: [
__dirname,
path.join(__dirname, 'js'),
],
alias: {
'jquery-slimscroll': path.join(node_path, 'jquery-slimscroll/jquery.slimscroll'),
}
},
devtool: 'eval-source-map',
module: {
loaders: [
{test: /\.(jpg|jpeg|png|gif|svg)$/, loader: 'file-loader'},
{test: /\.css$/, loader: css_loader},
{test: /\.less$/, loader: less_loader},
{test: /\.vue$/, loader: 'vue-loader'},
{test: /\.json$/, loader: 'json-loader'},
{test: /\.(woff|svg|ttf|eot|otf)([\?]?.*)$/, exclude: /img/, loader: 'file-loader?name=[name].[ext]'},
{test: /\.js$/, loader: 'babel-loader', include: [
path.resolve(__dirname, 'js'),
path.resolve(__dirname, 'node_modules/vue-strap/src'),
]
}
]
},
vue: {
loaders: {
css: 'vue-style?sourceMap!css?sourceMap',
less: 'vue-style?sourceMap!css?sourceMap!less?sourceMap=source-map-less-inline',
js: 'babel-loader'
}
},
babel: {
presets: ['env'],
comments: false,
plugins: [
['transform-builtin-extend', {globals: ['Error']}],
'transform-runtime',
]
},
// Store initial values for easier inheritance
defaults: {
languages,
},
plugins: [
// Prevent webpack 1.x false positive
require('webpack-fail-plugin'),
// Fix AdminLTE packaging
new webpack.NormalModuleReplacementPlugin(
/admin-lte\/build\/img\/boxed-bg\.jpg$/,
'admin-lte/dist/img/boxed-bg.jpg'
),
new webpack.ProvidePlugin({
jQuery: 'jquery', // Required by bootstrap.js
'window.jQuery': 'jquery', // Required by swagger.js jquery client
}),
new ExtractTextPlugin('[name].css'),
// Only include needed translations
new webpack.ContextReplacementPlugin(/moment\/locale$/, new RegExp('^' + languages.join('|') + '$')),
new webpack.ContextReplacementPlugin(/locales$/, new RegExp(languages.join('|'))),
new webpack.optimize.CommonsChunkPlugin({
name: 'common',
minChunks: 10, // (Modules must be shared between 10 entries)
})
],
node: {
fs: 'empty',
net: 'empty',
tls: 'empty'
}
};