From 51679eb66f47d0b3b1e1aa0752f4299fe09e7106 Mon Sep 17 00:00:00 2001 From: dotansimha Date: Tue, 24 Jan 2017 09:34:48 +0200 Subject: [PATCH] Step 1.4: Updated webpack config file --- webpack.config.js | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index f58f0d2bd..5552c3805 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -14,9 +14,16 @@ module.exports = { resolve: { extensions: ['.ts', '.js', '.json'], - modules: [path.resolve('node_modules')] + modules: [path.resolve('node_modules')], + alias: { + 'api': path.resolve(__dirname, 'api/server') + } }, + externals: [ + resolveExternals + ], + module: { loaders: [ { @@ -36,6 +43,9 @@ module.exports = { plugins: [ ionicWebpackFactory.getIonicEnvironmentPlugin(), + new webpack.ProvidePlugin({ + __extends: 'typescript-extends' + }) ], // Some libraries import Node modules but don't use them in the browser. @@ -43,6 +53,22 @@ module.exports = { node: { fs: 'empty', net: 'empty', - tls: 'empty' + tls: 'empty', + __dirname: true } }; + +function resolveExternals(context, request, callback) { + return resolveMeteor(request, callback) || + callback(); +} + +function resolveMeteor(request, callback) { + var match = request.match(/^meteor\/(.+)$/); + var pack = match && match[1]; + + if (pack) { + callback(null, 'Package["' + pack + '"]'); + return true; + } +}