diff options
author | Israel Lavi <israel.lavi@intl.att.com> | 2018-05-21 17:42:00 +0300 |
---|---|---|
committer | Israel Lavi <il0695@att.com> | 2018-05-21 17:52:01 +0300 |
commit | 1994c98063c27a41797dec01f2ca9fcbe33ceab0 (patch) | |
tree | f30beeaf15a8358f6da78fdd74bcbda74bd334f8 /webpack | |
parent | 4749f4631426fcbe29ed98cef8f24cab18b501d0 (diff) |
init commit onap ui
Change-Id: I1dace78817dbba752c550c182dfea118b4a38646
Issue-ID: SDC-1350
Signed-off-by: Israel Lavi <il0695@att.com>
Diffstat (limited to 'webpack')
-rw-r--r-- | webpack/helpers.js | 10 | ||||
-rw-r--r-- | webpack/webpack.test.js | 71 |
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' + ] + }, +}; |