From 2c9b7c401a2f7d2502ad3d187b0deea5e5502d35 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Wed, 28 Dec 2016 16:37:11 +0100 Subject: [PATCH] chore(gestures): fix treeshaking for core * Treeshaking may break in Webpack and other bundlers for the `core` exports because our compiled JavaScript files are trying to export everything (`export *`) from the gesture-annotations file The problem with the `gesture-annotations` is, that the transpiled JavaScript file is barely empty (due to TypeScript-only interfaces) * When exporting the different interfaces manually, TypeScript is smart-enough to export nothing in the resulting JavaScript file. Closes #2401 --- src/lib/core/core.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/core/core.ts b/src/lib/core/core.ts index c8c20f9b6228..8943114da921 100644 --- a/src/lib/core/core.ts +++ b/src/lib/core/core.ts @@ -55,7 +55,9 @@ export {ScrollDispatcher} from './overlay/scroll/scroll-dispatcher'; // Gestures export {GestureConfig} from './gestures/gesture-config'; -export * from './gestures/gesture-annotations'; +// Explicitly specify the interfaces which should be re-exported, because if everything +// is re-exported, module bundlers may run into issues with treeshaking. +export {HammerInput, HammerManager} from './gestures/gesture-annotations'; // Ripple export {MdRipple, MdRippleModule} from './ripple/ripple'; @@ -105,7 +107,7 @@ export * from './compatibility/default-mode'; // Animation export * from './animation/animation'; -// Coersion +// Coercion export {coerceBooleanProperty} from './coercion/boolean-property'; export {coerceNumberProperty} from './coercion/number-property';