From c633a05edaa3b22ef7cd0cd0ed47b9ea81d3e824 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20R=C3=B6der?= Date: Thu, 1 Nov 2018 14:06:32 +0100 Subject: [PATCH 1/2] Fixed webpack config issue --- app/angular/src/server/angular-cli_config.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/angular/src/server/angular-cli_config.js b/app/angular/src/server/angular-cli_config.js index 3043dff9c179..9d5d789499db 100644 --- a/app/angular/src/server/angular-cli_config.js +++ b/app/angular/src/server/angular-cli_config.js @@ -82,6 +82,8 @@ export function applyAngularCliWebpackConfig(baseConfig, cliWebpackConfigOptions return baseConfig; } + console.log(cliWebpackConfigOptions.supportES2015); + if (!isBuildAngularInstalled()) { logger.info('=> Using base config because @angular-devkit/build-angular is not installed.'); return baseConfig; @@ -94,8 +96,6 @@ export function applyAngularCliWebpackConfig(baseConfig, cliWebpackConfigOptions return baseConfig; } - logger.info('=> Get angular-cli webpack config.'); - const { cliCommonConfig, cliStyleConfig } = cliParts; // Don't use storybooks styling rules because we have to use rules created by @angular-devkit/build-angular @@ -126,6 +126,15 @@ export function applyAngularCliWebpackConfig(baseConfig, cliWebpackConfigOptions plugins: [ new TsconfigPathsPlugin({ configFile: cliWebpackConfigOptions.buildOptions.tsConfig, + // After ng build my-lib the default value of 'main' in the package.json is 'umd' + // This causes that you cannot import components directly from dist + // https://github.com/angular/angular-cli/blob/9f114aee1e009c3580784dd3bb7299bdf4a5918c/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/browser.ts#L68 + mainFields: [ + ...(cliWebpackConfigOptions.supportES2015 ? ['es2015'] : []), + 'browser', + 'module', + 'main', + ], }), ], }; From f7eb15cb46859746c472bbf5de321874ed9842a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20R=C3=B6der?= Date: Thu, 1 Nov 2018 14:19:10 +0100 Subject: [PATCH 2/2] Remove console.log; Re-added logger.info --- app/angular/src/server/angular-cli_config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/angular/src/server/angular-cli_config.js b/app/angular/src/server/angular-cli_config.js index 9d5d789499db..049167745352 100644 --- a/app/angular/src/server/angular-cli_config.js +++ b/app/angular/src/server/angular-cli_config.js @@ -82,8 +82,6 @@ export function applyAngularCliWebpackConfig(baseConfig, cliWebpackConfigOptions return baseConfig; } - console.log(cliWebpackConfigOptions.supportES2015); - if (!isBuildAngularInstalled()) { logger.info('=> Using base config because @angular-devkit/build-angular is not installed.'); return baseConfig; @@ -96,6 +94,8 @@ export function applyAngularCliWebpackConfig(baseConfig, cliWebpackConfigOptions return baseConfig; } + logger.info('=> Get angular-cli webpack config.'); + const { cliCommonConfig, cliStyleConfig } = cliParts; // Don't use storybooks styling rules because we have to use rules created by @angular-devkit/build-angular