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