mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 02:21:07 +08:00
Fixed webpack config issue
This commit is contained in:
parent
19352c705b
commit
c633a05eda
13
app/angular/src/server/angular-cli_config.js
vendored
13
app/angular/src/server/angular-cli_config.js
vendored
@ -82,6 +82,8 @@ export function applyAngularCliWebpackConfig(baseConfig, cliWebpackConfigOptions
|
|||||||
return baseConfig;
|
return baseConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(cliWebpackConfigOptions.supportES2015);
|
||||||
|
|
||||||
if (!isBuildAngularInstalled()) {
|
if (!isBuildAngularInstalled()) {
|
||||||
logger.info('=> Using base config because @angular-devkit/build-angular is not installed.');
|
logger.info('=> Using base config because @angular-devkit/build-angular is not installed.');
|
||||||
return baseConfig;
|
return baseConfig;
|
||||||
@ -94,8 +96,6 @@ export function applyAngularCliWebpackConfig(baseConfig, cliWebpackConfigOptions
|
|||||||
return baseConfig;
|
return baseConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info('=> Get angular-cli webpack config.');
|
|
||||||
|
|
||||||
const { cliCommonConfig, cliStyleConfig } = cliParts;
|
const { cliCommonConfig, cliStyleConfig } = cliParts;
|
||||||
|
|
||||||
// Don't use storybooks styling rules because we have to use rules created by @angular-devkit/build-angular
|
// 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: [
|
plugins: [
|
||||||
new TsconfigPathsPlugin({
|
new TsconfigPathsPlugin({
|
||||||
configFile: cliWebpackConfigOptions.buildOptions.tsConfig,
|
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',
|
||||||
|
],
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user