Skip to content

Commit

Permalink
fix(transpile): remove unneded remove-imports transform because it is…
Browse files Browse the repository at this point in the history
… causing issues with wildcard imports. fixes #526
  • Loading branch information
jthoms1 committed Feb 13, 2018
1 parent b01c6e7 commit 256e70a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 86 deletions.
29 changes: 29 additions & 0 deletions src/compiler/transpile/test/transpile.spec.ts
Expand Up @@ -376,6 +376,35 @@ describe('transpile', () => {
expect(r.components[0].dependencies).toEqual(['cmp-b', 'cmp-c']);
});

it('wildcard imports should remain within component files', async () => {
c.config.bundles = [ { components: ['cmp-a']}, { components: ['cmp-b'] } ];
await c.fs.writeFiles({
'/src/new-dir/cmp-a.tsx': `
import * as file from './file';
@Component({ tag: 'cmp-a' }) export class CmpA {
render() {
return file.file;
}
}
`,
'/src/new-dir/cmp-b.tsx': `
import * as file from './file';
@Component({ tag: 'cmp-b' }) export class CmpB {
render() {
return file.file;
}
}
`,
'/src/new-dir/file.ts': `export const file = 'filetext';`,
}, { clearFileCache: true });

await c.fs.commit();

const r = await c.build();
expect(r.diagnostics).toEqual([]);
expect(r.bundleBuildCount).toEqual(3);
});

});

});
84 changes: 0 additions & 84 deletions src/compiler/transpile/transformers/remove-imports.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/compiler/transpile/transpile.ts
Expand Up @@ -12,7 +12,6 @@ import { moduleGraph } from './transformers/module-graph';
import { normalizeAssetsDir } from '../component-plugins/assets-plugin';
import { normalizeStyles } from './normalize-styles';
import { removeDecorators } from './transformers/remove-decorators';
import { removeImports } from './transformers/remove-imports';
import { removeStencilImports } from './transformers/remove-stencil-imports';
import * as ts from 'typescript';

Expand Down Expand Up @@ -114,7 +113,6 @@ function transpileProgram(program: ts.Program, tsHost: ts.CompilerHost, config:
addComponentMetadata(compilerCtx.moduleFiles)
],
after: [
removeImports(),
removeStencilImports(),
moduleGraph(config, buildCtx),
componentDependencies(compilerCtx, buildCtx)
Expand Down

0 comments on commit 256e70a

Please sign in to comment.