aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/odlux/framework/webpack.vendor.js
diff options
context:
space:
mode:
authorherbert <herbert.eiselt@highstreet-technologies.com>2019-12-14 01:05:47 +0100
committerHerbert Eiselt <herbert.eiselt@highstreet-technologies.com>2019-12-16 12:52:11 +0000
commite6d0d67fdbe3fc70c996c8df33bd65d3b151dfad (patch)
tree0d2da7d1da74c6ebca6b53039741617d35f65d96 /sdnr/wt/odlux/framework/webpack.vendor.js
parent6b98928b7b1b0ebc28d2ef286e8c932fca67c305 (diff)
update odlux and featureaggregator
v2 update odlux and featureaggregator bundles Issue-ID: SDNC-1008 Signed-off-by: herbert <herbert.eiselt@highstreet-technologies.com> Change-Id: I0018d7bfa3a0e6896c1b210b539a574af9808e22 Signed-off-by: herbert <herbert.eiselt@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/odlux/framework/webpack.vendor.js')
-rw-r--r--sdnr/wt/odlux/framework/webpack.vendor.js130
1 files changed, 130 insertions, 0 deletions
diff --git a/sdnr/wt/odlux/framework/webpack.vendor.js b/sdnr/wt/odlux/framework/webpack.vendor.js
new file mode 100644
index 000000000..649c9b974
--- /dev/null
+++ b/sdnr/wt/odlux/framework/webpack.vendor.js
@@ -0,0 +1,130 @@
+/**
+ * Webpack 4 configuration file
+ * see https://webpack.js.org/configuration/
+ * see https://webpack.js.org/configuration/dev-server/
+ */
+
+"use strict";
+
+const path = require("path");
+const webpack = require("webpack");
+
+const TerserPlugin = require('terser-webpack-plugin');
+const ExtractTextPlugin = require('extract-text-webpack-plugin');
+const extractCSS = new ExtractTextPlugin('vendor.css');
+
+// const __dirname = (path => path.replace(/^([a-z]\:)/, c => c.toUpperCase()))(process.__dirname());
+
+module.exports = (env) => {
+ const distPath = path.resolve(__dirname, env === "release" ? "." : "..", "dist");
+ const frameworkPath = path.resolve(__dirname, env === "release" ? "." : "..", "dist");
+ return [{
+ name: "Vendor",
+ mode: "none", //disable default behavior
+ target: "web",
+
+ context: path.resolve(__dirname, "src"),
+
+ entry: {
+ vendor: [
+ "@babel/polyfill",
+ "@fortawesome/fontawesome-svg-core",
+ "@fortawesome/free-solid-svg-icons",
+ "@fortawesome/react-fontawesome",
+ "jquery",
+ "react",
+ "react-dom",
+ "react-router-dom",
+ "@material-ui/core"
+ ]
+ },
+
+ devtool: env === "release" ? false : "source-map",
+
+ resolve: {
+ extensions: [".ts", ".tsx", ".js", ".jsx"]
+ },
+
+ output: {
+ path: distPath,
+ library: "[name]", // related to webpack.DllPlugin::name
+ libraryTarget: "umd2",
+ filename: "[name].js",
+ chunkFilename: "[name].js"
+ },
+
+ module: {
+ rules: [{
+ test: /\.tsx?$/,
+ exclude: /node_modules/,
+ use: [{
+ loader: "babel-loader"
+ }, {
+ loader: "ts-loader"
+ }]
+ },
+ {
+ test: /\.jsx?$/,
+ exclude: /node_modules/,
+ use: [{
+ loader: "babel-loader"
+ }]
+ },
+ {
+ test: /\.(png|woff|woff2|eot|ttf|svg)$/,
+ loader: 'url-loader?limit=100000&name=assets/[name].[ext]'
+ }, {
+ test: /\.s?css$/i,
+ loader: extractCSS.extract(['css-loader?minimize', 'sass-loader'])
+ }, {
+ test: /\.json$/,
+ loader: 'json-loader'
+ },
+ ]
+ },
+
+ optimization: {
+ noEmitOnErrors: true,
+ namedModules: env !== "release",
+ minimize: env === "release",
+ minimizer: env !== "release" ? [] : [new TerserPlugin({
+ terserOptions: {
+ warnings: false, // false, true, "verbose"
+ compress: {
+ drop_console: true,
+ drop_debugger: true,
+ }
+ }
+ })],
+ },
+
+ plugins: [
+ extractCSS,
+ new webpack.DllPlugin({
+ context: path.resolve(__dirname, "src"),
+ name: "[name]",
+ path: path.resolve(distPath, "[name]-manifest.json")
+ }),
+ ...(env === "release") ? [
+ new webpack.DefinePlugin({
+ "process.env": {
+ NODE_ENV: "'production'",
+ VERSION: JSON.stringify(require("./package.json").version)
+ }
+ })
+ ] : [
+ new webpack.HotModuleReplacementPlugin(),
+ new webpack.DefinePlugin({
+ "process.env": {
+ NODE_ENV: "'development'",
+ VERSION: JSON.stringify(require("./package.json").version)
+ }
+ }),
+ new webpack.WatchIgnorePlugin([
+ /s?css\.d\.ts$/,
+ /less\.d\.ts$/
+ ])
+ ]
+ ]
+ }];
+}