forked from cschleiden/azure-boards-estimate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
113 lines (97 loc) · 2.56 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
'use strict';
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const proxy = require('./server/webpack-dev-proxy');
const loaders = require('./webpack/loaders');
const styleLintPlugin = require('stylelint-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
const baseAppEntries = [
'./src/index.tsx',
];
const devAppEntries = [
'webpack-hot-middleware/client?reload=true',
];
const appEntries = baseAppEntries
.concat(process.env.NODE_ENV === 'development' ? devAppEntries : []);
const basePlugins = [
new webpack.DefinePlugin({
__DEV__: process.env.NODE_ENV !== 'production',
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
}),
// new webpack.optimize.CommonsChunkPlugin('vendor', '[name].[hash].js'),
new HtmlWebpackPlugin({
template: './src/index.ejs',
inject: false // we inject ourselves in the template
}),
new CopyWebpackPlugin([
{ from: "./node_modules/vss-web-extension-sdk/lib/VSS.SDK.min.js", to: "libs/VSS.SDK.min.js" }
//{ from: "./src/*.html", to: "./" },
//{ from: "./marketplace", to: "marketplace" },
//{ from: "./vss-extension.json", to: "vss-extension-release.json" }
]),
new ProgressBarPlugin()
];
const devPlugins = [
new webpack.NoErrorsPlugin()
];
const prodPlugins = [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})
];
const plugins = basePlugins
.concat(process.env.NODE_ENV === 'production' ? prodPlugins : [])
.concat(process.env.NODE_ENV === 'development' ? devPlugins : []);
module.exports = {
target: "web",
entry: {
app: appEntries,
vendor: [
'es5-shim',
'es6-shim',
'es6-promise',
'react',
'react-dom',
'react-router'
]
},
externals: [
/^q$/, /^VSS\/.*/, /^TFS\/.*/
],
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].js',
publicPath: '/',
sourceMapFilename: '[name].js.map',
chunkFilename: '[id].chunk.js',
libraryTarget: "amd"
},
devtool: 'source-map',
resolve: {
extensions: ['', '.webpack.js', '.web.js', '.tsx', '.ts', '.js']
},
plugins: plugins,
devServer: {
historyApiFallback: { index: '/' },
proxy: proxy(),
},
module: {
preLoaders: [
loaders.tslint,
],
loaders: [
loaders.tsx,
loaders.html,
loaders.scss,
loaders.svg,
loaders.eot,
loaders.woff,
loaders.woff2,
loaders.ttf,
]
}
};