Skip to content

Commit

Permalink
Step 1.3: Updated webpack config file
Browse files Browse the repository at this point in the history
  • Loading branch information
dotansimha authored and DAB0mB committed Mar 23, 2017
1 parent 5f75ed9 commit 4a7dc24
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions webpack.config.js
Expand Up @@ -13,9 +13,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 @@ -31,14 +38,33 @@ module.exports = {
},

plugins: [
ionicWebpackFactory.getIonicEnvironmentPlugin()
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 4a7dc24

Please sign in to comment.