Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

Commit

Permalink
fix(webpack): patch @angular2-material
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickJS committed Sep 17, 2016
1 parent 9ec4ae2 commit b34cfff
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ var commonConfig = {
extensions: ['', '.ts', '.js', '.json']
},
module: {
preLoaders: [
],
loaders: [
// TypeScript
{ test: /\.ts$/, loaders: ['ts-loader', 'angular2-template-loader'] },
Expand Down Expand Up @@ -53,7 +51,16 @@ var serverConfig = {
path: root('dist/server'),
libraryTarget: 'commonjs2'
},
externals: checkNodeImport,
module: {
preLoaders: [
{ test: require.resolve('@angular2-material/card'), loader: "imports-loader?window=>global" },
{ test: require.resolve('@angular2-material/core'), loader: "imports-loader?window=>global" }

This comment has been minimized.

Copy link
@PatrickJS

PatrickJS Sep 17, 2016

Author Member

add more depending on material components

],
},
externals: excludeClientPackages([
'@angular2-material/card',
'@angular2-material/core'
]),

This comment has been minimized.

Copy link
@PatrickJS

PatrickJS Sep 17, 2016

Author Member

include more material components here

node: {
global: true,
__dirname: true,
Expand Down Expand Up @@ -88,6 +95,14 @@ module.exports = [
webpackMerge({}, defaultConfig, commonConfig, serverConfig)
];

function excludeClientPackages(packages) {
return function(context, request, cb) {
if (packages && packages.indexOf(request) !== -1) {
return cb();
}
return checkNodeImport(context, request, cb);
};
}
// Helpers
function checkNodeImport(context, request, cb) {
if (!path.isAbsolute(request) && request.charAt(0) !== '.') {
Expand Down

0 comments on commit b34cfff

Please sign in to comment.