Use vite today, with vue-cli.
Vue SFC template ts
support.window.process.env.XXX
use before create.Thanks to @ZenDay.
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' })],
},
},
}
ref: vue-cli #3499 support config file return function:
module.exports = {
// config
}
or
module.exports = () => {
return {
// config
}
}
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
<img src="//p0.meituan.com/xxx.png" />
~public/path/to/use
or ~/public/path/to/use
@import '~@/styles/xxx'
VUE_APP_ENV=staging yarn vite
process.env.BASE_URL
like vue-clihttps://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
. :)
thanks to vite-plugin-checker & vite-plugin-eslint
both vite-plugin-checker & vite-plugin-eslint working only for dev(serve) right now.
Thanks a lot @sh-winter. refer PR: https://github.com/IndexXuan/vite-plugin-html-template/pull/1
vue-cli-plugin-vite is now v1.0.0 after rc1 ~ 6.