vitejs / vite-plugin-vue2

Vite plugin for Vue 2.7
MIT License
543 stars 46 forks source link

Vue template compiler warnings are handled as errors #88

Open susnux opened 1 year ago

susnux commented 1 year ago

When building for development all template compiler warnings are treated as errors instead of warning and will break the build.

Examples for such warnings are:

text \"Some comment\" between v-if and v-else(-if) will be ignored.

When having a template like this:

<component v-if="foo" />
<!-- Some comment -->
<component v-else />
susnux commented 1 year ago

For example it could be fixed by changing https://github.com/vitejs/vite-plugin-vue2/blob/ad7d61e0cc545a6dd2c29954dddf036425971560/src/template.ts#L65

to something like:

(process.env.NODE_ENV === 'production' ? pluginContext.error : pluginContext.warn)(

As I think this warning is converted to an error somewhere more deep inside the compiler-sfc.