IndexXuan / vue-cli-plugin-vite

Use vite today, with vue-cli.

Home Page:https://github.com/IndexXuan/vue-cli-plugin-vite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incompatibility with unplugin-icons

Akryum opened this issue · comments

The default alias { find: /^~/, replacement: '' } removes the ~ in ~icons/... paths breaking unplugin-icons.

Example path: ~icons/feather/search

yes it is not css-loader syntax but weird… will hack handle it.

Workaround vite plugin:

{
  name: 'vite-fix-unplugin-icons',
  enforce: 'post',
  config (config) {
    // https://github.com/IndexXuan/vue-cli-plugin-vite/issues/49
    const index = config.resolve.alias.findIndex(a => a.find.toString() === '/^~/')
    if (index !== -1) config.resolve.alias.splice(index, 1)
  },
}

really. just remove it will make some css-loader syntax compat failed.

https://github.com/IndexXuan/vite-plugin-vue-cli/blob/main/src/index.ts#L128
I think we can change this regexp except for icons. can you try?

Maybe it could be configurable?

your regexp works? I will try it tomorrow. If it works, I dont think it need configurable.

aha, unplugin and vue-cli-plugin-vite plays well in nature, very nice ~

examples use vue-cli(yarn build) will report error of sourcemap ... so I comment it ...
yarn vite:build is right.

I dont know. maybe unplugin-icons issue.