Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve ignore error with cache #356

Closed
wants to merge 2 commits into from
Closed

fix: resolve ignore error with cache #356

wants to merge 2 commits into from

Conversation

lishaobos
Copy link
Collaborator

@lishaobos lishaobos commented Apr 4, 2023

related change

unjs/unimport#237

description

when my options like this:

isProxy and h is in vue

      ignore: ['isProxy', 'h'],
      exclude: [/\.remote/],
      cache: true,
      imports: [
        'vue',
        {
          'vue-router': [
            'useLink',
            'useRoute',
            'useRouter',
            'onBeforeRouteLeave',
            'onBeforeRouteUpdate',
            'createRouter',
            'createWebHistory',
          ],
        },
      ],

but now I used cache.

in cache.json, have the same Api like this

    {
      "from": "vue",
      "name": "watchEffect",
      "as": "watchEffect"
    },
    {
      "from": "vue",
      "name": "reactive",
      "as": "reactive"
    },

the same Api caused the dedupeImports delete error.

image

if I filter the cacheImports, everything be ok.

     const map = await unimport.getImportMap();
      const cacheImports = Object.values(cacheData)
        .reduce((p, n) => p.concat(n), [])
        .filter((i) => !(map.get(i.as ?? i.name)?.from === i.from))
      return imports.concat(cacheImports)

@lishaobos lishaobos closed this Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant