vuejs / component-compiler-utils

Lower level utilities for compiling Vue single file components
321 stars 75 forks source link

TypeError: postcss_1.default is not a function #9

Closed ulivz closed 6 years ago

ulivz commented 6 years ago

Summary

Version: 1.2.0

Recently many users reported an error at https://github.com/vuejs/vuepress/issues/268, and I reproduced it at my local.

After the investigation, I found:

https://github.com/vuejs/component-compiler-utils/blob/14d4ced9bc7ac4514bcbf51ca133529088c2887b/lib/compileStyle.ts#L70

It's will be compiled into:

result = postcss_1.default(plugins).process(source, postCSSOptions);

But in postcss's dist code, the module was exported as:

exports.default = postcss;
module.exports = exports['default'];

So the module should be used as postcss_1 instead of postcss_1.default.

And I don't know if this is a problem of TSC. but it's truly a issue introduced by upgrade of vue-loader/@vuejs/component-compiler-utils

719media commented 6 years ago

This happened to me as well. Compiled js before (version 1.1.0) result = postcss(plugins).process(source, postCSSOptions);

Compiled js after (version 1.2.0): result = postcss_1.default(plugins).process(source, postCSSOptions);

znck commented 6 years ago

Fixed in 1.2.1.