-
Notifications
You must be signed in to change notification settings - Fork 18
/
webpack.config.js
93 lines (90 loc) · 2.55 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
// Hack for Ubuntu on Windows: interface enumeration fails with EINVAL, so return empty.
try {
require('os').networkInterfaces();
} catch (e) {
require('os').networkInterfaces = () => ({});
}
var fs = require('fs');
var gracefulFs = require('graceful-fs');
gracefulFs.gracefulify(fs);
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const CopyWebpackPlugin = require('copy-webpack-plugin');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const webpack = require('webpack');
const path = require("path");
module.exports = {
context: path.join(__dirname, 'app/assets'),
entry: {
//teambuilder: "./javascript/teambuilder.js",
frontend: "./javascript/frontend.js",
battlewindow: "./javascript/battles/simplebattlewindow.js"
},
output: {
path: path.join(__dirname, "public/"),
filename: "javascript/[name].js"
},
devtool: "source-map",
module: {
rules: [
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
use: "css-loader",
fallback: "style-loader"
})
},
{
test: /\.less$/,
use: ExtractTextPlugin.extract({
use:"css-loader!less-loader",
fallback: "style-loader"
})
},
{
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
use: "file-loader?publicPath=../&name=./files/[hash].[ext]"
},
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
use: "url-loader?publicPath=../&name=./files/[hash].[ext]&limit=10000&mimetype=application/font-woff"
},
{
test: /\.png$/,
use: "url-loader?publicPath=../&name=./files/[hash].[ext]&limit=10000&mimetype=image/png"
}
]
},
plugins: [
//new webpack.optimize.CommonsChunkPlugin("common"),
new webpack.ProvidePlugin({ $: 'jquery', jquery: 'jquery', jQuery: 'jquery' }),
new ExtractTextPlugin("stylesheets/styles.css"),
new CopyWebpackPlugin([{
context: __dirname,
from: "node_modules/jquery/dist/jquery.min.js",
to: "javascript"
}, /* {
context: __dirname,
from: "node_modules/bootstrap-colorpicker/dist/img",
to: "img"
},*/ {
from: "images",
to: "images"
}, {
from: "sounds",
to: "sounds"
}, {
from: "fonts",
to: "fonts"
}])/* Still causes problems with arrow functions, waiting for a more stable version
of uglifyJS.
new UglifyJSPlugin() */
],
resolve: {
alias: {
handlebars: 'handlebars/dist/handlebars.min.js'
}
},
externals: {
jquery: 'jQuery'
}
}