2 * ============LICENSE_START========================================================================
3 * ONAP : ccsdk feature sdnr wt odlux
4 * =================================================================================================
5 * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
6 * =================================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software distributed under the License
13 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14 * or implied. See the License for the specific language governing permissions and limitations under
16 * ============LICENSE_END==========================================================================
19 * Webpack 4 configuration file
20 * see https://webpack.js.org/configuration/
21 * see https://webpack.js.org/configuration/dev-server/
26 const path = require("path");
27 const webpack = require("webpack");
28 const CopyWebpackPlugin = require("copy-webpack-plugin");
29 const requirejsPlugin = require('requirejs-webpack-plugin');
30 const TerserPlugin = require('terser-webpack-plugin');
32 // const __dirname = (path => path.replace(/^([a-z]\:)/, c => c.toUpperCase()))(process.__dirname());
34 module.exports = (env) => {
35 const distPath = path.resolve(__dirname, env === "release" ? "." : "..", "dist");
36 const frameworkPath = path.resolve(__dirname, env === "release" ? "." : "..", "dist");
39 mode: "none", //disable default behavior
42 context: path.resolve(__dirname, "src"),
49 "./components/objectDump",
50 "./components/material-table",
51 "./components/material-ui",
52 "./utilities/elasticSearch",
56 devtool: env === "release" ? false : "source-map",
59 extensions: [".ts", ".tsx", ".js", ".jsx"]
64 library: "[name]", // related to webpack.DllPlugin::name
65 libraryTarget: "umd2",
66 filename: "[name].js",
67 chunkFilename: "[name].js"
73 exclude: /node_modules/,
75 loader: "babel-loader"
81 exclude: /node_modules/,
83 loader: "babel-loader"
88 test: /\.(png|gif|jpg|svg)$/,
93 name: './images/[name].[ext]'
101 noEmitOnErrors: true,
102 namedModules: env !== "release",
103 minimize: env === "release",
104 minimizer: env !== "release" ? [] : [new TerserPlugin({
107 reserved: ["./app.tsx"]
109 warnings: false, // false, true, "verbose"
119 new CopyWebpackPlugin([{
120 from: '../../node_modules/requirejs/require.js',
123 from: './favicon.ico',
126 from: env === "release" ? './index.html' : 'index.dev.html',
129 new requirejsPlugin({
131 filename: 'config.js',
134 processOutput: function (assets) {
135 let mainConfig = JSON.stringify(assets, null, 2);
136 mainConfig = mainConfig.slice(0,-1); // remove closing bracket from string
137 const entireConfig = mainConfig.concat(", waitSeconds: 30}"); // add waitSeconds to config
138 return 'require.config(' + entireConfig + ')';
141 // new HtmlWebpackPlugin({
142 // filename: "index.html",
143 // template: "./index.html",
146 // new HtmlWebpackIncludeAssetsPlugin({
147 // assets: ['vendor.js'],
150 new webpack.DllReferencePlugin({
151 context: path.resolve(__dirname, "src"),
152 manifest: require(path.resolve(frameworkPath, "vendor-manifest.json")),
155 new webpack.DllPlugin({
156 context: path.resolve(__dirname, "src"),
158 path: path.resolve(distPath, "[name]-manifest.json")
160 ...(env === "release" ? [
161 new webpack.DefinePlugin({
163 NODE_ENV: "'production'",
164 VERSION: JSON.stringify(require("./package.json").version)
168 new webpack.HotModuleReplacementPlugin(),
169 new webpack.DefinePlugin({
171 NODE_ENV: "'development'",
172 VERSION: JSON.stringify(require("./package.json").version)
175 new webpack.WatchIgnorePlugin([
179 new CopyWebpackPlugin([{
180 from: './assets/version.json',
187 public: "http://localhost:3100",
188 contentBase: distPath,
192 "Access-Control-Allow-Origin": "*"
196 disableHostCheck: true,
197 historyApiFallback: true,
206 // target: "http://10.20.6.29:48181",
207 target: "http://sdnr:8181",
211 target: "http://sdnr:8181",
215 // target: "https://10.20.35.188:30205",
216 target: "http://sdnr:8181",
220 // target: "https://10.20.35.188:30205",
221 target: "http://sdnr:8181",
225 target: "http://sdnr:8181",
229 target: "http://sdnr:8181",
233 target: "http://sdnr:8181",
237 target: "http://sdnr:8181",
241 target: "http://sdnr:8181",
245 target: "http://sdnr:8181",
249 target: "http://sdnr:8181",
255 target: "http://sdnr:8181",