Permalink
Browse files

Step 1.5: Updated webpack config file

  • Loading branch information...
dotansimha authored and darkbasic committed Jan 24, 2017
1 parent 01e1551 commit e50053b33f0efba87fc8291e9f277fe05f3a5512
Showing with 42 additions and 7 deletions.
  1. +42 −7 webpack.config.js
View
@@ -74,9 +74,16 @@ var devConfig = {
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: [
{
@@ -92,15 +99,19 @@ var devConfig = {
plugins: [
ionicWebpackFactory.getIonicEnvironmentPlugin(),
ionicWebpackFactory.getCommonChunksPlugin()
ionicWebpackFactory.getCommonChunksPlugin(),
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
}
};
@@ -116,9 +127,16 @@ var prodConfig = {
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: getProdLoaders()
},
@@ -127,21 +145,38 @@ var prodConfig = {
ionicWebpackFactory.getIonicEnvironmentPlugin(),
ionicWebpackFactory.getCommonChunksPlugin(),
new ModuleConcatPlugin(),
new PurifyPlugin()
new PurifyPlugin(),
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;
}
}
module.exports = {
dev: devConfig,
prod: prodConfig
}

0 comments on commit e50053b

Please sign in to comment.