question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

There are tsx and vue files in the project, can't both files be automatically imported?

See original GitHub issue

In the .vue file, it works fine

// vite.config.ts
IconsResolver({
  enabledCollections: ['ep']
})

But in tsx, I tried to write like this, but it didn’t work😢

// vite.config.ts
plugins: [
  Icons({
    jsx: 'react', // 'react' or 'preact'
    compiler: 'jsx', // 'vue2', 'vue3', 'jsx'
  }),
  // Api自动导入
  AutoImport({
    resolvers: [
      IconsResolver({
        prefix: 'i', // 图标前缀,默认为i
        enabledCollections: ['ep'],
        extension: 'jsx',
      }),
    ],
  }),
  // 按需导入组件
  Components({
    resolvers: [
      // 自动注册图标组件
      IconsResolver({
        prefix: 'i', // 图标前缀,默认为i
        extension: 'jsx',
        enabledCollections: ['ep'],
      }),
    ],
  }),
],

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:21

github_iconTop GitHub Comments

2reactions
wangrongdingcommented, Jul 12, 2022

@userquin OK, thank you very much!👍🥰

1reaction
wangrongdingcommented, Jul 12, 2022

@userquin thank you, my friend. However, you need to wait for a while, I will provide you with it when I get home from getting off work later~ 😂

about an hour later…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot import from a typescript Vue component into ... - GitHub
Both components are writting in Typescript. NOTE: I can import the TS vue component into another TS file, i.e., App.vue into example.ts.
Read more >
Vue with TSX - the perfect duo!? - Arek Nawo
Take a look at an example component (TSX + Composition API): import { defineComponent } from "vue"; import HelloWorld from "./components/ ...
Read more >
How to remove .vue extension from imports when using ...
This is why you need the .vue extension: if you remove it, Typescript doesn't know the type of the file and can't compile....
Read more >
Importing Components in React From Other Files - Upmostly
In React, importing is the same as in vanilla JavaScript. ... In the file App.js automatically generated by the create-react-app command:.
Read more >
TypeScript Compiling with Visual Studio Code
A tsconfig.json file defines the TypeScript project settings, such as the ... To exclude JavaScript files generated from both .ts and .tsx source...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found