2 * Webpack 4 configuration file
3 * see https://webpack.js.org/configuration/
4 * see https://webpack.js.org/configuration/dev-server/
9 const path = require("path");
10 const webpack = require("webpack");
11 const CopyWebpackPlugin = require("copy-webpack-plugin");
12 const TerserPlugin = require('terser-webpack-plugin');
14 // const __dirname = (path => path.replace(/^([a-z]\:)/, c => c.toUpperCase()))(process.__dirname());
16 module.exports = (env) => {
17 const distPath = path.resolve(__dirname, env === "release" ? "." : "../..", "dist");
18 const frameworkPath = path.resolve(__dirname, env === "release" ? "../../framework" : "../..", "dist");
22 mode: "none", //disable default behavior
26 context: path.resolve(__dirname, "src"),
29 networkMapApp: ["./pluginTransport.tsx"]
32 devtool: env === "release" ? false : "source-map",
35 extensions: [".ts", ".tsx", ".js", ".jsx"]
40 filename: "[name].js",
42 libraryTarget: "umd2",
43 chunkFilename: "[name].js"
48 exclude: /node_modules/,
50 loader: "babel-loader"
56 exclude: /node_modules/,
58 loader: "babel-loader"
62 test: /\.(png|gif|jpg|svg)$/,
67 name: './icons/[hash].[ext]'
73 use: ["style-loader", "css-loader"],
79 namedModules: env !== "release",
80 minimize: env === "release",
81 minimizer: env !== "release" ? [] : [new TerserPlugin({
83 warnings: false, // false, true, "verbose"
93 new webpack.DllReferencePlugin({
94 context: path.resolve(__dirname, "../../framework/src"),
95 manifest: require(path.resolve(frameworkPath, "vendor-manifest.json")),
98 new webpack.DllReferencePlugin({
99 context: path.resolve(__dirname, "../../framework/src"),
100 manifest: require(path.resolve(frameworkPath, "app-manifest.json")),
103 ...(env === "release") ? [
104 new webpack.DefinePlugin({
106 NODE_ENV: "'production'",
107 VERSION: JSON.stringify(require("./package.json").version)
111 new webpack.DefinePlugin({
113 NODE_ENV: "'development'",
114 VERSION: JSON.stringify(require("./package.json").version)
117 new CopyWebpackPlugin([{
125 public: "http://localhost:3100",
126 contentBase: frameworkPath,
130 "Access-Control-Allow-Origin": "*"
134 disableHostCheck: true,
135 historyApiFallback: true,
144 target: "http://sdnr:8181",
148 target: "http://sdnr:8181",
152 target: "http://sdnr:8181",
156 target: "http://sdnr:8181",
160 target: "http://sdnr:8181",
164 target: "http://sdnr:8181",
168 target: "http://sdnr:8181",
172 target: "http://localhost:3002",
176 target: "http://localhost:3002",
178 pathRewrite(pathname) {
179 return pathname.replace(/^\/sitedoc/, '/topology/stadok')
183 target: "http://tile.openstreetmap.org",
187 target: "http://sdnr:8181",
191 target: "http://sdnr:8181",