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

Commit b34cfff

Browse files
committed
fix(webpack): patch @angular2-material
1 parent 9ec4ae2 commit b34cfff

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

webpack.config.ts

+18-3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ var commonConfig = {
88
extensions: ['', '.ts', '.js', '.json']
99
},
1010
module: {
11-
preLoaders: [
12-
],
1311
loaders: [
1412
// TypeScript
1513
{ test: /\.ts$/, loaders: ['ts-loader', 'angular2-template-loader'] },
@@ -53,7 +51,16 @@ var serverConfig = {
5351
path: root('dist/server'),
5452
libraryTarget: 'commonjs2'
5553
},
56-
externals: checkNodeImport,
54+
module: {
55+
preLoaders: [
56+
{ test: require.resolve('@angular2-material/card'), loader: "imports-loader?window=>global" },
57+
{ test: require.resolve('@angular2-material/core'), loader: "imports-loader?window=>global" }
58+
],
59+
},
60+
externals: excludeClientPackages([
61+
'@angular2-material/card',
62+
'@angular2-material/core'
63+
]),
5764
node: {
5865
global: true,
5966
__dirname: true,
@@ -88,6 +95,14 @@ module.exports = [
8895
webpackMerge({}, defaultConfig, commonConfig, serverConfig)
8996
];
9097

98+
function excludeClientPackages(packages) {
99+
return function(context, request, cb) {
100+
if (packages && packages.indexOf(request) !== -1) {
101+
return cb();
102+
}
103+
return checkNodeImport(context, request, cb);
104+
};
105+
}
91106
// Helpers
92107
function checkNodeImport(context, request, cb) {
93108
if (!path.isAbsolute(request) && request.charAt(0) !== '.') {

0 commit comments

Comments
 (0)