Skip to content

CSS Problem on --prod build when use custom-webpack #16485

@lihuabest

Description

@lihuabest

use @angular-builders/custom-webpack to export webpack.config.js hook,src/styles.css can't build with ng build --prod. @angular/cli version is @angular/cli": "~8.2.2, even i test latest.

20191221093528

styles has no name and no file. this is simple code of webpack.config.js
`
const path = require('path');

module.exports = (config, options) => {
config.plugins.push(spritePlugin);

  config.module.rules = config.module.rules.filter(
    rule => rule.test.toString() !== '/\\.css$/'
);

// CSS Module support
config.module.rules.push({
    test: /\.(css)$/,
    use: [
        'style-loader',
        'css-loader',
    ],
});

return config

};

`

code can't run with ng build --prod,to fix the problem i use ng build --extract-css=false, but lose some of performance. export webpack config, we can do more things like use postcss...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions