-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwebpack.config.js
More file actions
96 lines (85 loc) · 1.96 KB
/
webpack.config.js
File metadata and controls
96 lines (85 loc) · 1.96 KB
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
94
95
96
var path = require('path');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var destFolder = '/build';
var olExternals = {
root: 'ol',
commonjs2: 'openlayers',
commonjs: 'openlayers',
amd: 'openlayers'
};
var proj4Externals = {
root: 'proj4',
commonjs2: 'proj4',
commonjs: 'proj4',
amd: 'proj4'
};
var config = {
context: __dirname,
debug: true,
cache: true,
verbose: true,
displayErrorDetails: true,
stats: {
colors: true,
reasons: true
},
resolve: {
extensions: ['', '.webpack.js', '.ts', '.js', '.css', '.styl']
},
entry: {
'elements': [
'./src/components/zoombar/mdl-slider.css',
'./src/elements.styl',
'./src/elements.ts',
'./node_modules/material-design-lite/material.min.js'
]
},
output: {
path: path.join(__dirname, destFolder),
filename: '[name].js',
sourceMapFilename: '[name].js.map',
chunkFilename: '[id].chunk.js',
libraryTarget: 'umd'
},
externals: [{
'ol': olExternals,
'openlayers': olExternals,
'proj4': proj4Externals,
'rx': 'rx'
}],
// modles to compile .less and include .css
// in the .ts use code like: require('./button.less');
module: {
loaders: [
{
test: /\.ts$/,
loader: 'ts-loader'
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader")
},
{
test: /\.less$/,
loader: ExtractTextPlugin.extract('style', 'css!less')
},
{
test: /\.styl$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader!stylus-loader')
},
{
test: /\.jade$/,
loader: 'template-html-loader'
}
]
},
// Use the plugin to specify the resulting filename (and add needed behavior to the compiler)
plugins: [
new ExtractTextPlugin("[name].css")
],
stylus: {
use: [require('nib')()],
import: ['~nib/lib/nib/index.styl']
}
};
module.exports = config;