-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
57 lines (53 loc) · 1.65 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
/* eslint "import/no-extraneous-dependencies": ["error", {"devDependencies": true}] */
const path = require('path');
const UglifyJsPlugin = require('webpack').optimize.UglifyJsPlugin;
const DefinePlugin = require('webpack').DefinePlugin;
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const sharedConfig = require('./webpack/shared-config');
const extractCss = new ExtractTextPlugin({ filename: 'visualization.css' });
const plugins = [
extractCss,
new DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV),
},
}),
];
if (process.env.NODE_ENV === 'production') {
plugins.push(new UglifyJsPlugin({ compress: { warnings: false } }));
}
process.traceDeprecation = true;
module.exports = {
entry: 'visualization_source',
resolve: {
modules: [path.join(__dirname, 'src'), 'node_modules'],
},
resolveLoader: {
modules: [path.join(__dirname, 'webpack'), 'node_modules'],
},
output: {
filename: 'visualization.js',
path: path.join(__dirname, 'appserver', 'static', 'visualizations', 'timewrap'),
libraryTarget: 'amd',
},
externals: [
'api/SplunkVisualizationBase',
'api/SplunkVisualizationUtils',
],
module: {
rules: [
sharedConfig.BABEL_LOADER,
{
test: /\.css$/,
use: extractCss.extract({ use: ['css-loader', 'postcss-loader'] }),
},
// {
// test: /^d3$/,
// use: {
// loader: 'd3-no-global-loader',
// },
// },
],
},
plugins,
};