This repository has been archived by the owner on Jun 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
executable file
·85 lines (77 loc) · 2.59 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
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const StringReplacePlugin = require("string-replace-webpack-plugin");
module.exports = {
entry: {
index: './leaflet-control-mbgltimeslider-control.js',
},
output: {
path: __dirname + '/dist/',
filename: 'leaflet-control-mbgltimeslider.js',
},
module: {
loaders: [
/*
* Plain JS files
* just kidding; Webpack already does those without any configuration :)
* but we do not want to lump them in with ES6 files: they would be third-party and then run through JSHint and we can't waste time linting third-party JS
*/
/*
* run .js6 files through Babel + ES-ENV via loader; lint and transpile into X.js
* that's our suffix for ECMAScript 2015 / ES6 files
*/
{
test: /\.js$/,
use: [
{ loader: 'babel-loader', options: { presets: ['env'] } },
{ loader: 'jshint-loader', options: { esversion: 6, emitErrors: true, failOnHint: true } }
],
exclude: /node_modules/
},
/*
* CSS files and also SASS-to-CSS all go into one bundled X.css
*/
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
use: [
{ loader: 'css-loader', options: { minimize: true, sourceMap: true, url: false } }
],
fallback: 'style-loader'
})
},
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
use: [
{ loader: 'css-loader', options: { minimize: true, sourceMap: true, url: false } },
{ loader: 'sass-loader', options: { sourceMap:true } },
],
fallback: 'style-loader'
})
}
]
},
/*
* enable source maps, applicable to both JS and CSS
*/
devtool: "nosources-source-map",
/*
* plugins for the above
*/
plugins: [
// CSS output from the CSS + LESS handlers above
new ExtractTextPlugin({
disable: false,
filename: 'leaflet-control-mbgltimeslider.css'
}),
// for doing string replacements on files
new StringReplacePlugin(),
],
/*
* plugins for the above
*/
devServer: {
contentBase: '.',
port: 9100
}
};