diff options
Diffstat (limited to 'webapp/webpack.config.js')
-rw-r--r-- | webapp/webpack.config.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/webapp/webpack.config.js b/webapp/webpack.config.js index 6471731eb..191518a07 100644 --- a/webapp/webpack.config.js +++ b/webapp/webpack.config.js @@ -2,6 +2,7 @@ const webpack = require('webpack'); const path = require('path'); const ExtractTextPlugin = require('extract-text-webpack-plugin'); const CopyWebpackPlugin = require('copy-webpack-plugin'); +const nodeExternals = require('webpack-node-externals'); const htmlExtract = new ExtractTextPlugin('html', 'root.html'); @@ -9,6 +10,7 @@ const NPM_TARGET = process.env.npm_lifecycle_event; //eslint-disable-line no-pro var DEV = false; var FULLMAP = false; +var TEST = false; if (NPM_TARGET === 'run' || NPM_TARGET === 'run-fullmap') { DEV = true; if (NPM_TARGET === 'run-fullmap') { @@ -16,6 +18,11 @@ if (NPM_TARGET === 'run' || NPM_TARGET === 'run-fullmap') { } } +if (NPM_TARGET === 'test') { + DEV = false; + TEST = true; +} + var config = { entry: ['babel-polyfill', './root.jsx', 'root.html'], output: { @@ -36,6 +43,15 @@ var config = { } }, { + test: /node_modules\/mattermost\/client\.jsx?$/, + loader: 'babel', + query: { + presets: ['react', 'es2015-webpack', 'stage-0'], + plugins: ['transform-runtime'], + cacheDirectory: DEV + } + }, + { test: /\.json$/, loader: 'json' }, @@ -139,4 +155,9 @@ if (!DEV) { ); } +// Test mode configuration +if (TEST) { + config.externals = [nodeExternals()]; +} + module.exports = config; |