Skip to content

Commit

Permalink
Step 1.5: Updated webpack config file
Browse files Browse the repository at this point in the history
  • Loading branch information
dotansimha authored and darkbasic committed Oct 16, 2017
1 parent 01e1551 commit e50053b
Showing 1 changed file with 42 additions and 7 deletions.
49 changes: 42 additions & 7 deletions webpack.config.js
Expand Up @@ -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: [
{
Expand All @@ -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
}
};

Expand All @@ -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()
},
Expand All @@ -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.