Updating versions of Sparky FE files
[aai/sparky-fe.git] / webpack.devConfig.js
1 /*
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
4  * ================================================================================
5  * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6  * Copyright © 2017 Amdocs
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *       http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  *
21  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22  */
23 'use strict';
24
25 var path = require('path');
26 var webpack = require('webpack');
27 var devPort = process.env.PORT || 8001;
28
29 module.exports = {
30         devtool: 'eval-source-map',
31         entry: {
32                 'aai/bundle': [
33                         'app/main.app.jsx',
34                         `webpack-dev-server/client?https://localhost:${devPort}`,
35                         'webpack/hot/only-dev-server'
36                 ],
37                 'editAttributes/editAttributesBundle': [
38                         'editAttributes/main.app.jsx',
39                         `webpack-dev-server/client?https://localhost:${devPort}`,
40                         'webpack/hot/only-dev-server'
41                 ]
42         },
43         output: {
44                 path: path.join(__dirname, 'dist'),
45                 publicPath: `https://localhost:${devPort}/`,
46                 filename: '[name].js'
47         },
48         resolve: {
49                 root: [path.resolve('.')],
50                 alias: {
51                         app: 'src/app',
52                         'generic-components': 'src/generic-components',
53                         utils: 'src/utils',
54                         images: 'resources/images',
55                         editAttributes: 'src/editAttributes'
56                 }
57         },
58         devServer: {
59                 port: devPort,
60                 historyApiFallback: true,
61                 publicPath: `https://localhost:${devPort}/`,
62                 contentBase: path.join(__dirname, 'dist'),
63                 hot: true,
64                 progress: true,
65                 inline: true,
66                 debug: true,
67   https: true,
68                 stats: {
69                         colors: true
70                 }
71         },
72         module: {
73                 preLoaders: [
74                         {test: /\.(js|jsx)$/, loader: 'source-map-loader'}
75                 ],
76                 loaders: [
77                         {test: /\.(js|jsx)$/, loaders: ['babel-loader', 'eslint-loader'], exclude: /node_modules/},
78                         {test: /\.(css|scss)$/, loaders: ['style', 'css?sourceMap', 'sass?sourceMap']},
79                         // required for font icons
80                         {test: /\.(woff|woff2)(\?.*)?$/, loader: 'url-loader?limit=16384&mimetype=application/font-woff'},
81                         {test: /\.(ttf|eot|otf)(\?.*)?$/, loader: 'file-loader'},
82                         {test: /\.(png|jpg|svg)(\?.*)?$/, loader: 'url-loader?limit=16384'},
83                         {test: /\.json$/, loaders: ['json']}
84                 ]
85         },
86         eslint: {
87                 configFile: './.eslintrc',
88                 emitError: true,
89                 emitWarning: true
90         },
91         plugins: [
92                 new webpack.DefinePlugin({
93                         DEBUG: true
94                 }),
95
96                 new webpack.HotModuleReplacementPlugin()
97         ]
98 };