diff --git a/packages/language-service/BUILD.bazel b/packages/language-service/BUILD.bazel index 3379d4e4f7..7239b0da4a 100644 --- a/packages/language-service/BUILD.bazel +++ b/packages/language-service/BUILD.bazel @@ -8,6 +8,7 @@ ts_library( "api.ts", "index.ts", ], + prodmode_module = "commonjs", deps = [ "@npm//@types/node", "@npm//typescript", diff --git a/packages/language-service/index.ts b/packages/language-service/index.ts index 6b02ff5ca9..5d4e0219ce 100644 --- a/packages/language-service/index.ts +++ b/packages/language-service/index.ts @@ -9,8 +9,6 @@ import * as ts from 'typescript/lib/tsserverlibrary'; import {NgLanguageService, PluginConfig} from './api'; -export * from './api'; - interface PluginModule extends ts.server.PluginModule { create(createInfo: ts.server.PluginCreateInfo): NgLanguageService; onConfigurationChanged?(config: PluginConfig): void; @@ -35,4 +33,9 @@ const factory: ts.server.PluginModuleFactory = (tsModule): PluginModule => { }; }; -module.exports = factory; +/** + * Tsserver expects `@angular/language-service` to provide a factory function + * as the default export of the package. See + * https://github.com/microsoft/TypeScript/blob/f4d0ea6539edb6d8f70b626132d6f9ac1ac4281a/src/server/project.ts#L1611 + */ +export = factory;