Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

vendor js/css not minified with env-prod command? #844

Closed
@aherrick

Description

@aherrick

Using the base webpack files. Running the following webpack command:

webpack --config webpack.config.vendor.js --env.prod

I'm seeing it regenerate the vendor.css and vendor.js successfully locally.

However when I open the vendor.css file I'm not seeing it minified. I also have the template published to Azure, and it's not minified there either.

What am I missing here?

Activity

etimesg

etimesg commented on Apr 5, 2017

@etimesg
Contributor

Hello Andrew,

I believe that's expected. AFAIK css-loader doesn't minimize per default and I couldn't find any treatment for that inside the webpack config files. However, you can workaround this limitation by replacing the CSS rule inside webpack.config.vendor.js with:

{ test: /\.css(\?|$)/, use: extractCSS.extract({ use: isDevBuild ? 'css-loader' : 'css-loader?minimize' }) }

Please be advised that I only had time to test it using the Angular template. Perhaps someone can address whether a PR to support minified vendor.css in production is welcome and if there is a better approach to implement it.

Best,
E

aherrick

aherrick commented on Apr 5, 2017

@aherrick
Author

@etimesg thanks for the response! Still getting my head wrapped around webpack but this modification makes sense.

I too am interested in any other suggestions or why it wasn't set to be minimized in Prod by default.

SteveSandersonMS

SteveSandersonMS commented on Apr 7, 2017

@SteveSandersonMS
Member

I think it could be minified in the prod builds. That would be a nice enhancement. A pull request for that would be welcomed :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

        Participants

        @etimesg@aherrick@SteveSandersonMS

        Issue actions

          vendor js/css not minified with env-prod command? · Issue #844 · aspnet/JavaScriptServices