forked from rubenspgcavalcante/leaflet-ant-path
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
90 lines (86 loc) · 2.31 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
var webpack = require("webpack");
var path = require("path");
var utils = require("./tasks/utils");
var plugins = [];
var entries = {};
var externals = {};
if (utils.hasArgument("--minimize", "-m")) {
plugins.push(new webpack.optimize.UglifyJsPlugin({minimize: true}));
}
if (utils.hasArgument("--development", "-d")) {
entries["dev-env"] = "./dev-env/index.js";
plugins.push(new webpack.NoErrorsPlugin());
plugins.push(new webpack.HotModuleReplacementPlugin());
}
else {
entries["leaflet-ant-path"] = "./src/plugin/main";
externals = {
"leaflet": {
root: "L",
commonjs: "leaflet",
commonjs2: "leaflet",
amd: "leaflet"
}
};
}
module.exports = {
entry: entries,
externals: externals,
devtool: "source-map",
output: {
path: "./dist",
filename: "[name].js",
library: "leaflet-ant-path",
libraryTarget: "umd"
},
devServer: {
contentBase: 'dev-env',
inline: true,
hot: true
},
plugins: plugins,
module: {
preLoaders: [
{
test: /\.js$/,
exclude: /node_modules|~/,
loader: require.resolve('eslint-loader')
},
],
loaders: [
{
test: /\.js$/,
exclude: /node_modules|~/,
loader: require.resolve("babel-loader")
},
{
test: /\.css$/,
exclude: '/node_modules/',
loaders: [
require.resolve("style-loader"),
require.resolve("css-loader"),
]
},
{
test: /\.(scss|sass)$/,
exclude: '/node_modules/',
loaders: [
require.resolve("style-loader"),
require.resolve("css-loader"),
require.resolve("sass-loader")
]
},
{
test: /\.(woff2?|svg)$/, loader: 'url?limit=10000'
},
{
test: /\.(ttf|eot|png|jpge?g)$/, loader: 'file'
},
{
test: /\.json$/,
exclude: '/node_modules/',
loader: 'json'
}
]
}
};