Releases: IndexXuan/vue-cli-plugin-vite
upgrade vite 2.6+ & fix process.env issue when development
support unplugin-icons / add example for unplugin ecosystem.
unplugin-icons
use ~icon/aaa/bbb
while this ~
is not css-loader syntax
and should not replaced it with empty string. this publish hack the alias regexp for ~
and make unplugin-icons
works. Thanks @Akryum.
add example for unplugin ecosystem
, unplugin
and vue-cli-plugin-vite
plays well in nature. very nice.
module.exports = {
lintOnSave: process.env.NODE_ENV !== 'production',
devServer: {
overlay: false,
},
configureWebpack: {
plugins: [require('unplugin-icons/webpack')({ compiler: 'vue2' })],
},
pluginOptions: {
vite: {
disabledTypeChecker: true,
plugins: [require('unplugin-icons/vite')({ compiler: 'vue2' })],
},
},
}
support config file return function
ref: vue-cli #3499
support config file return function:
module.exports = {
// config
}
or
module.exports = () => {
return {
// config
}
}
improve find project config file error handler
this plugin will require vue.config.js
for extra vite plugins merge. this release improve the error report of it.
something like TypeError/ReferenceError
but slient when project don't have vue.config.js
.
let vueConfig = {}
try {
vueConfig = require(resolve(process.env.CLI_CONFIG_FILE || 'vue.config.js')) || {}
} catch (e) {
// handle no vue.config.js
if (e.code === 'MODULE_NOT_FOUND') {
if (process.env.VITE_DEBUG) {
console.error(chalk.redBright(e))
}
} else {
console.error(chalk.redBright(e.stack ?? e))
}
}
close: #38
css-loader and more vue-cli consistence
- support assets without protocol, e.g.
<img src="//p0.meituan.com/xxx.png" />
- support
~public/path/to/use
or~/public/path/to/use
- support
@import '~@/styles/xxx'
- support dynamic injected(prefixed) env, e.g.
VUE_APP_ENV=staging yarn vite
- inject
process.env.BASE_URL
like vue-cli
Add css-loader url resolve compat.
https://webpack.js.org/loaders/css-loader/#url
Now in Vue SFC, you can use ~@/assets/logo.png
both in template block
and style block
.
~
will be ignore for vite
and useful for css-loader
.
Your code compat with vite
and vue-cli
. :)
Type Checker & Eslint Support
thanks to vite-plugin-checker & vite-plugin-eslint
- vue-cli use fork-ts-checker-webpack-plugin(not support template block), vite-plugin-checker use vls, it is better. the errors overlay respect to devServer.overlay options.
- vue-cli have lineOnSave options and we can infer and respect to it, vite-plugin-eslint like eslint-loader for webpack.
both vite-plugin-checker & vite-plugin-eslint working only for dev(serve) right now.
Finally fix the vue-router history-mode SPA fallback with html-template
First Stable Release - V1
vue-cli-plugin-vite is now v1.0.0 after rc1 ~ 6.