Vue-loader: postcss does not work as expected with vue-loader

Created on 3 Sep 2018  路  7Comments  路  Source: vuejs/vue-loader

Version

15.4.0

Reproduction link

https://github.com/JounQin/test/commit/ba578d339b1b3bf3155c850192b8b460e7cede2c

Steps to reproduce

Clone https://github.com/JounQin/test and checkout branch vue-loader, run yarn build and check dist/main.*.css file, it is minified. Change code back to Vue style version and run yarn build again, dist/main.*.css is not minified correctly.

What is expected?

dist/main.*.css should be minified.

What is actually happening?

dist/main.*.css is not minified.

Most helpful comment

It seems @yyx990803 you have came back to 'work', would like to check about this issue?

All 7 comments

I find out it is caused by https://github.com/vuejs/component-compiler-utils/blob/master/lib/stylePlugins/trim.ts#L7.

It is named trim, should it be raws.before = raws.after = ''?

@yyx990803 @Jinjiang @blake-newman Please help...

It seems @yyx990803 you have came back to 'work', would like to check about this issue?

I'd love to see progress as well :relaxed:

Related PR (merged but didn't solve the problem AFAIK): https://github.com/vuejs/component-compiler-utils/pull/36

@JounQin Could you change the title of the PR to something more descriptive? 馃

I just ran your reproduction and can't seem to reproduce the problem. I'm not sure how your repo even is related to vue-loader since it's importing a .scss file which not handled by vue-loader at all.

Also not able to reproduce the minification issue via vue-cli, so I assume this has something to do with your specific setup, but I don't know what the problem is without proper reproduction.

FYI, the trim plugin has always worked like that for over a year. This has never been a problem and unlikely to be the root cause.

I just ran the repro from https://github.com/cssnano/cssnano/issues/586 and it also minifies properly, so this is likely already fixed in some related dependency which originally caused the problem, unless a proper reproduction can be provided.

I was able to reproduce this via Vue CLI as I noticed this only happens for CSS inlined in JavaScript. Let's track this in https://github.com/vuejs/component-compiler-utils/pull/40 instead.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yozman picture yozman  路  4Comments

chrisvfritz picture chrisvfritz  路  4Comments

flashios09 picture flashios09  路  3Comments

sdvcrx picture sdvcrx  路  3Comments

birdgg picture birdgg  路  3Comments