-
-
Notifications
You must be signed in to change notification settings - Fork 596
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
SFC without a script tag show an error when trying to import #1187
Comments
Same. Even with functional components. eg: <template functional>
<i class="pe-7s-attention fa-4x text-warning"></i>
</template> I think it's since the VSCode update |
I also have this same bug |
1 similar comment
I also have this same bug |
workaround: just add a empty class then resolve. -- |
And Vetur show the same error if you split code into files like : <template>
<div class="logout">
Logout !
</div>
</template>
<script src="./logout.js"></script>
<style scoped lang="scss" src="./logout.scss"></style> Output Vetur |
I think this may be a different problem. |
Rollback to the previous version of Vetur for example 0.19.0, should fix the issue Vetur(2306) |
0.19.0 same as 0.19.1 |
I know it makes no sense at all, but the Vetur(2306) error was solved after renaming the first file that started reporting problems. PD: I think this is a different error and you should open a new Issue if it keeps occurring. |
This is still happening on 0.19.1
This might work but vue supports functional templates (with no script block) which means vetur should not complain about it. Also if you include a script block is it still a functional component? (I dunno - haven't tried myself). The best workaround I guess would be to rewrite with a render method and not use a template... |
I came across the same problem. |
Updated to 0.19.5 (vscode 1.33.1) and the issue went away. Edit: the components in my project have |
Probably because
|
@uri - after applying the setting you mentioned, the problem did not return. Here are the contents of my settings.json file. To be sure about the correct settings location, I changed the
Edit: the components in my project have |
Strange, I'm still seeing the problem the repro repo I made: https://github.com/uri/vetur-import-example |
Issue not closed -> This is not fixed yet |
@uri I fetched your example project and noticed the error. Although updating to 0.19.5 eliminated the |
Until this is fixed adding the following worked for me:
|
Please, fix it sooner than "never". It's really annoying to add this to SVG component icons. |
The first thing that met me when I tried to work with the typescript is this error |
Any chance we could see a fix here soon? |
same error |
As @mpvosseller suggested, adding below at the bottom of the file fixes the problem. <script lang="ts">
import Vue from 'vue';
export default Vue.extend({
//
});
</script> NB: Am using TypeScript. But js counterpart should work just fine |
Indeed @dannysofftie's solution works, but this shouldn't be an exception in the first place. |
please fix this bug, it is very annoying |
If anyone can test #1806?
PS. https://github.com/vuejs/vetur/blob/master/.github/CONTRIBUTING.md |
@yoyo930021 tested. LGTM! |
Love you man, I don't know how you found this. They should update the docs |
April 2020
|
Second that. Error still showing for importing .vue files with or without script tag. Doesn't matter. In my case I'm importing it inside a script tag with lang set to ts, since I'm using typescript. A workaround that does not involve empty exports for scenario's in which you do have a script tag with a src attribute set to the js/ts file, is the following.
|
Wait for #1806 |
2 months have passed, still not merged. Or they won't implement it because of Vue 3 release is under the nose. |
@webcoderkz I don't have any permissions for this project. |
I added this to my
This fixed the issue for me. |
@jaideepheer is this documented somewhere? I've tried this, but didn't work for me. Can you paste your functional component? |
Hi anyone, I publish self-maintenance vscode extension. https://marketplace.visualstudio.com/items?itemName=yoyo930021.vuter |
@yoyo930021 awesome 👌 |
Both errors should be fixed as we merge @yoyo930021's work in #1806. |
vetur 0.26.1 with
Using
and my <template>
<div>hello world</div>
</template> |
@clouds56 Please share a full repro https://github.com/vuejs/vetur/blob/master/.github/NO_REPRO_CASE.md and open a new issue. I cannot repro: |
My fault, I've write vue-shims.d.ts myself with declare module "*.vue" {
import { ComponentPublicInstance } from "vue";
const Component: ComponentPublicInstance;
export default Component;
} and I updated it to declare module "*.vue" {
import { ComponentPublicInstance } from "vue";
const Component: ComponentPublicInstance | {};
export default Component;
} and things goes well. Thanks for response. |
no fix yet ? |
Info
Problem
Components without a script tag and an export are flagged with an error:
Reproducible Case
Here is the diff to a brand new project created with vue-cli:
Here is the repo that shows the problem:
https://github.com/uri/vetur-import-example
The text was updated successfully, but these errors were encountered: