Skip to content

Commit

Permalink
Step 1.4: Updated webpack config file
Browse files Browse the repository at this point in the history
  • Loading branch information
dotansimha authored and darkbasic committed Jun 13, 2017
1 parent a29329d commit 51679eb
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions webpack.config.js
Expand Up @@ -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: [
{
Expand All @@ -36,13 +43,32 @@ module.exports = {

plugins: [
ionicWebpackFactory.getIonicEnvironmentPlugin(),
new webpack.ProvidePlugin({
__extends: 'typescript-extends'
})
],

// Some libraries import Node modules but don't use them in the browser.
// Tell Webpack to provide empty mocks for them so importing them works.
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;
}
}

0 comments on commit 51679eb

Please sign in to comment.