From 40be1f26e57ed39faf2d0865f6895be340ca13c1 Mon Sep 17 00:00:00 2001 From: Trotyl Yu Date: Tue, 21 Nov 2017 03:35:34 +0800 Subject: [PATCH] fix: using correct global name in bundle (#8407) --- tools/package-tools/build-bundles.ts | 4 ++-- tools/package-tools/rollup-globals.ts | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/package-tools/build-bundles.ts b/tools/package-tools/build-bundles.ts index a68eba62e71..676770132a1 100644 --- a/tools/package-tools/build-bundles.ts +++ b/tools/package-tools/build-bundles.ts @@ -3,7 +3,7 @@ import {uglifyJsFile} from './minify-sources'; import {buildConfig} from './build-config'; import {BuildPackage} from './build-package'; import {rollupRemoveLicensesPlugin} from './rollup-remove-licenses'; -import {rollupGlobals} from './rollup-globals'; +import {rollupGlobals, dashCaseToCamelCase} from './rollup-globals'; // There are no type definitions available for these imports. const rollup = require('rollup'); @@ -51,7 +51,7 @@ export class PackageBundler { return this.bundleEntryPoint({ entryFile, esm5EntryFile, - moduleName: `ng.${packageName}.${entryPoint}`, + moduleName: `ng.${packageName}.${dashCaseToCamelCase(entryPoint)}`, esm2015Dest: join(bundlesDir, `${packageName}`, `${entryPoint}.js`), esm5Dest: join(bundlesDir, `${packageName}`, `${entryPoint}.es5.js`), umdDest: join(bundlesDir, `${packageName}-${entryPoint}.umd.js`), diff --git a/tools/package-tools/rollup-globals.ts b/tools/package-tools/rollup-globals.ts index c9222cbe77f..1d08c970d5a 100644 --- a/tools/package-tools/rollup-globals.ts +++ b/tools/package-tools/rollup-globals.ts @@ -3,7 +3,8 @@ import {getSubdirectoryNames} from './secondary-entry-points'; import {buildConfig} from './build-config'; /** Method that converts dash-case strings to a camel-based string. */ -const dashCaseToCamelCase = (str: string) => str.replace(/-([a-z])/g, (g) => g[1].toUpperCase()); +export const dashCaseToCamelCase = + (str: string) => str.replace(/-([a-z])/g, (g) => g[1].toUpperCase()); /** List of potential secondary entry-points for the cdk package. */ const cdkSecondaryEntryPoints = getSubdirectoryNames(join(buildConfig.packagesDir, 'cdk'));