aboutsummaryrefslogtreecommitdiffstats
path: root/webpack
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2018-05-21 20:19:48 +0000
committerGerrit Code Review <gerrit@onap.org>2018-05-21 20:19:48 +0000
commit05b37297177e8a342668c15e5d6f738b51f7aedd (patch)
treee236c96df52a13f935292db8aa73e84d0c41ad8a /webpack
parent884dfb789593d2a3cc319047ab1f0215778aec9f (diff)
parent1994c98063c27a41797dec01f2ca9fcbe33ceab0 (diff)
Merge "init commit onap ui"HEAD2.0.0-ONAPmasterbeijing2.0.0-ONAP
Diffstat (limited to 'webpack')
-rw-r--r--webpack/helpers.js10
-rw-r--r--webpack/webpack.test.js71
2 files changed, 81 insertions, 0 deletions
diff --git a/webpack/helpers.js b/webpack/helpers.js
new file mode 100644
index 0000000..c2c3717
--- /dev/null
+++ b/webpack/helpers.js
@@ -0,0 +1,10 @@
+var path = require('path');
+
+var _root = path.resolve(__dirname, '..');
+
+function root(args) {
+ args = Array.prototype.slice.call(arguments, 0);
+ return path.join.apply(path, [_root].concat(args));
+}
+
+exports.root = root;
diff --git a/webpack/webpack.test.js b/webpack/webpack.test.js
new file mode 100644
index 0000000..9057d4e
--- /dev/null
+++ b/webpack/webpack.test.js
@@ -0,0 +1,71 @@
+/****************************************************************************************
+ * Webpack test configuration file
+ * Using the current configuration we are able to bundle all the files we need for our
+ * unit testings.
+ ***************************************************************************************/
+
+
+'use strict';
+
+/**
+ * Dependencies:
+ * path: node library for resolving full path names
+ * webpack: for use in our testings
+ */
+const path = require('path');
+const webpack = require('webpack');
+const helpers = require('./helpers');
+module.exports = {
+ /**
+ * Choose a developer tool to enhance debugging. inline-source-map - A SourceMap is added as DataUrl to the JavaScript file.
+ */
+ devtool: 'inline-source-map',
+
+ /**
+ * Set webpack loaders and preloaders for typescript, angular2, SASS and HTML,
+ * so that webpack will be able to process and bundle them.
+ */
+ module: {
+
+ rules: [
+ {
+ test: /.ts$/,
+ exclude: /node_modules/,
+ use: [
+ 'awesome-typescript-loader',
+ 'angular2-template-loader',
+ 'angular2-router-loader'
+ ]
+ },
+ { test: /\.html$/, loader: "html-loader" },
+ {
+ test: /.scss$/,
+ use: ['style-loader', 'css-loader', 'sass-loader'],
+ include: path.resolve(__dirname, '../')
+ },
+
+ ]
+ },
+
+ plugins: [
+ // Workaround for angular/angular#11580
+ new webpack.ContextReplacementPlugin(
+ // The (\\|\/) piece accounts for path separators in *nix and Windows
+ ///angular(\\|\/)core(\\|\/)@angular/,
+ /@angular(\\|\/)core(\\|\/)/,
+ helpers.root('./src'), // location of your src
+ {} // a map of your routes
+ ),
+ ],
+
+ /**
+ * This section lets Webpack know which types of file extensions it should be loading.
+ */
+ resolve: {
+ extensions: ['.js', '.ts'],
+ modules: [
+ path.resolve('.', 'src'),
+ 'node_modules'
+ ]
+ },
+};