Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular CLI + Custom Config Causes Errors #2848

Closed
amcdnl opened this issue Jan 27, 2018 · 2 comments
Closed

Angular CLI + Custom Config Causes Errors #2848

amcdnl opened this issue Jan 27, 2018 · 2 comments

Comments

@amcdnl
Copy link
Member

amcdnl commented Jan 27, 2018

Issue

When you have a Angular CLI project that storybook is bootstrapping on and you use full control mode in combination with that the loaders are getting clobbered.

For example, I use DefinePlugin to conditionally include tests in full control mode:

const fs = require('fs');
const webpack = require('webpack');

module.exports = (storybookBaseConfig, configType) => {
    storybookBaseConfig.plugins.push(
        new webpack.DefinePlugin({
            TESTS: fs.existsSync('./.test-results.json')
        })
    );

    return storybookBaseConfig;
};

When I run storybook, it throws errors like:

ERROR in ./src/assets/fonts/MarkWebPro-LightW01Regular.eot
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)
 @ ./node_modules/css-loader?{"import":false}!./node_modules/postcss-loader/lib?{"ident":"postcss"}!./src/assets/styles/custom.css 7:1595-1645 7:1678-1728
 @ ./src/assets/styles/custom.css

Which seems to indicate that the loaders are getting clobbered somehow. If I remove webpack.config.js, everything works fine though.

@amcdnl
Copy link
Member Author

amcdnl commented Jan 27, 2018

After digging through the code, I found the CLI config is the third argument. If you use that, everything works fine.

module.exports = (storybookBaseConfig, configType, cliConfig) => {
    cliConfig.plugins.push(
        new webpack.DefinePlugin({
            TESTS: fs.existsSync('./.test-results.json')
        })
    );

    return cliConfig;
};

We should probably update the docs for this.

@amcdnl amcdnl closed this as completed Jan 27, 2018
@igor-dv
Copy link
Member

igor-dv commented Jan 27, 2018

Actually, docs are updated =) And that caused to another misunderstanding #2836 =)))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants