forked from facebookarchive/fixed-data-table
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
97 lines (86 loc) · 2.08 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
var webpack = require('webpack');
var resolvers = require('./build_helpers/resolvers');
var path = require('path');
var glob = require('glob');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var packageJSON = require('./package.json');
var banner = (
'/**\n' +
' * FixedDataTable v' + packageJSON.version + ' \n' +
' *\n' +
' * Copyright (c) 2015, Facebook, Inc.\n' +
' * All rights reserved.\n' +
' *\n' +
' * This source code is licensed under the BSD-style license found in the\n' +
' * LICENSE file in the root directory of this source tree. An additional grant\n' +
' * of patent rights can be found in the PATENTS file in the same directory.\n' +
' */\n'
);
var plugins = [
new ExtractTextPlugin('[name].css'),
new webpack.DefinePlugin({
'__DEV__': JSON.stringify(process.env.NODE_ENV !== 'production')
}),
resolvers.resolveHasteDefines
];
var entry = {};
var entryPoints = glob.sync(
path.join(__dirname, './src/**/*.css')
);
entryPoints.push('./src/FixedDataTableRoot.js');
if (process.env.COMPRESS) {
plugins.push(
new webpack.optimize.UglifyJsPlugin({
compressor: {
warnings: false
},
output: {comments: false}
})
);
entry['fixed-data-table.min'] = entryPoints;
} else {
entry['fixed-data-table'] = entryPoints;
}
plugins.push(
new webpack.BannerPlugin(banner, {raw: true})
);
module.exports = {
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract(
'style-loader',
[
'css-loader',
path.join(__dirname, './build_helpers/cssTransformLoader.js')
].join('!')
)
},
],
},
entry: entry,
output: {
library: 'FixedDataTable',
libraryTarget: 'umd',
path: 'dist',
filename: '[name].js',
},
externals: {
react: {
root: 'React',
commonjs: 'react',
commonjs2: 'react',
amd: 'react',
},
},
node: {
Buffer: false
},
plugins: plugins
};