Skip to content
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 opened this issue Apr 5, 2017 · 3 comments
Closed

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

aherrick opened this issue Apr 5, 2017 · 3 comments

Comments

@aherrick
Copy link

aherrick commented Apr 5, 2017

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?

@etimesg
Copy link
Contributor

etimesg commented Apr 5, 2017

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
Copy link
Author

aherrick commented Apr 5, 2017

@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
Copy link
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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants