vuejs / vue-component-compiler

Compile a single file Vue component into a CommonJS module.
MIT License
344 stars 52 forks source link

fix: set correct clean-css import #103

Closed przemkow closed 4 years ago

przemkow commented 4 years ago

Incorrect import cause an error during compilation:

[!] (VuePlugin plugin) TypeError: clean_css_1.default is not a constructor

I tried to use import * as CleanCSS from 'clean-css' but then it was not working correctly in unit tests.

znck commented 4 years ago

I wonder why tests were passing earlier. Can you add a note (with link to this issue) so we don't repeat the mistake?

przemkow commented 4 years ago

I added comment above the import.

This is a very good question. Especially that when the build has the correct syntax test is failing, maybe is something related to ts-jest? I will check it later because it looks pretty interesting if I find something I will let you know :)

przemkow commented 4 years ago

ok, it seems it was something related to test runner itself. After updating Jest to 25.2.3 test from the previous version does not have false-positive result.

I can update Jest in separate PR as there are some types errors in test/baseline.spec.ts and utils.ts which needs to be reviewed.