Initialize the UI code
[holmes/rule-management.git] / rulemgt / src / main / frontend / src / config / webpack.dev.js
1 /* Copyright 2017 ZTE Corporation.
2  *
3  *Licensed under the Apache License, Version 2.0 (the "License");
4  *you may not use this file except in compliance with the License.
5  *You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 const webpackMerge = require('webpack-merge'); 
16 const commonConfig = require('./webpack.common.js');  
17 const helpers = require('./helpers');
18
19
20 /**
21  * Webpack Plugins
22  */
23 const DefinePlugin = require('webpack/lib/DefinePlugin');
24 const ExtractTextPlugin = require('extract-text-webpack-plugin');
25 const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
26 const CopyWebpackPlugin = require('copy-webpack-plugin');
27
28
29 module.exports = webpackMerge(commonConfig, {
30
31
32  
33
34   devtool: 'source-map',
35
36
37
38   output: {
39
40
41    
42     path: helpers.root('holmes'),
43
44     
45     filename: '[name].bundle.js',
46
47     
48     sourceMapFilename: '[name].map',
49
50     
51     chunkFilename: '[id].chunk.js'
52   },
53
54
55
56   module: {
57
58     rules: [
59       {
60         test: /\.ts$/,
61         use: [
62           {
63             loader: 'tslint-loader',
64             options: {
65               configFile: 'tslint.json',
66               fileOutput: {
67                 dir: './foo/',
68
69                 ext: 'xml',
70
71                 clean: true,
72
73                 header: '<?xml version="1.0" encoding="utf-8"?>\n<checkstyle version="5.7">',
74
75                 footer: '</checkstyle>'
76               }
77             }
78           }
79         ],
80         exclude: [/\.(spec|e2e)\.ts$/]
81       },
82
83       {
84         test: /\.css$/,
85         use: ['to-string-loader', 'style-loader', 'css-loader'],
86         include: [helpers.root('alarm/assets'), helpers.root('public')]
87       },
88
89     ]
90
91   },
92
93
94
95   plugins: [
96    
97
98     new CopyWebpackPlugin([
99       { from: helpers.root('public/thirdparty/js/jquery_1.12.4.min.js'), to: helpers.root('holmes/public/js') },
100       { from: helpers.root('public/common/js/popModal.js'), to: helpers.root('holmes/public/js') },
101       { from: helpers.root('public/common/js/jQuery-File-Upload/js/jquery.ui.widget.js'), to: helpers.root('holmes/public/js') },
102       { from: helpers.root('public/common/js/jQuery-File-Upload/js/vendor/jquery.ui.widget.js'), to: helpers.root('holmes/public/js') },
103       { from: helpers.root('public/common/js/jQuery-File-Upload/js/jquery.iframe-transport.js'), to: helpers.root('holmes/public/js') },
104       { from: helpers.root('public/common/js/jQuery-File-Upload/js/jquery.fileupload.js'), to: helpers.root('holmes/public/js') },
105       { from: helpers.root('i18n'), to: helpers.root('holmes/i18n') },
106       { from: helpers.root('public/thirdparty/images/'), to: helpers.root('holmes/public/thirdparty/images') }
107     ]),
108
109
110    
111     new DefinePlugin({
112       VERSION: JSON.stringify('version'),
113       CONST2: JSON.stringify('CONST2')
114     }),
115
116     
117   ],
118
119
120
121
122  
123   devServer: {
124
125     port: 9528, 
126
127     host: '10.74.24.20', 
128
129     historyApiFallback: true,
130
131     inline: true, 
132
133     progress: true, 
134
135     colors: true, 
136
137     watch: false
138   },
139
140
141   node: {
142     global: true,
143     console: true,
144     crypto: 'empty',
145     process: true,
146     module: false,
147     clearImmediate: false,
148     setImmediate: false
149   }
150
151
152
153 });