Fixed webpack config issue

This commit is contained in:
Kai Röder 2018-11-01 14:06:32 +01:00
parent 19352c705b
commit c633a05eda

View File

@ -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',
],
}),
],
};