Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export function buildOptimizer(options: BuildOptimizerOptions): TransformJavascr
getTransforms.unshift(getImportTslibTransformer);
}

getTransforms.unshift(getWrapEnumsTransformer);
getTransforms.push(getWrapEnumsTransformer);

const transformJavascriptOpts: TransformJavascriptOptions = {
content: content,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,35 @@ describe('build-optimizer', () => {
expect(tags.oneLine`${boOutput.content}`).toEqual(output);
expect(boOutput.emitSkipped).toEqual(false);
});

it('should not wrap classes which had all static properties dropped in IIFE', () => {
const classDeclaration = tags.oneLine`
import { Injectable } from '@angular/core';

class Platform {
constructor(_doc) {
}
init() {
}
}
`;
const input = tags.oneLine`
${classDeclaration}

Platform.decorators = [
{ type: Injectable }
];

/** @nocollapse */
Platform.ctorParameters = () => [
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT] }] }
];
`;

const boOutput = buildOptimizer({ content: input, isSideEffectFree: true });
expect(tags.oneLine`${boOutput.content}`).toEqual(classDeclaration);
expect(boOutput.emitSkipped).toEqual(false);
});
});


Expand Down