-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
Recent update seems to have broken WebStorms ability to find components #51
Comments
Hi @leeovery. Please ensure |
Hi
I already have that option set.
I’m sorry but I disagree that this isn’t related to the ide. That’s the tool which we use to make the code. If the module doesn’t work with how the ide expects it has an opposite effect in that the module makes life for the developer worse rather than better.
This update renders the module unusable for me and I can’t be alone.
Having errors every time I create a component because it’s not imported sort of defeats the point of the plugin.
I’d have to add the component to the custom html tag list or import manually to lose the errors.
But this wasn’t the case prior to the most recent update.
Thanks
Lee
…Sent from my iPhone
On 16 Jun 2020, at 16:33, pooya parsa ***@***.***> wrote:
Hi @leeovery. Please ensure components: true (or with array value) is set inside nuxt.config. Not related to IDE.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
@pi0 To be clear with what the issue is here.... Prior to the v0.3.4 update, the component imports were picked up by the IDE and therefore the use of the components didn't generate an IDE error. However, now the importing layout seems to have changed in nuxt/components/index.js and as a result, the IDE is now not picking up the imports/definitions. This means that the component use in the templates is showing an error as the ide doesn't know where they live, or even whether they exist. I'll add, in both cases I am correctly using the plugin. It's registered in The issue is the IDE isn't able to pick up the registration of the imports since the latest update. And whilst this isn't a bug in the code as such - an issue like this will result in problems, because nobody likes seeing their code scattered with ide errors. Edit: Another important issue is lack of autocompletion as a result of the IDE not being able to register the new import structure. |
Hi @leeovery, Sorry but with all description you provided, I still can't figure out what's wrong with " not picking up the imports/definitions". If you wanted would be happy having a chat on discord (probably sharing screen) to see what's not working. |
@pi0 That would be great, thank you. Im about whenever you are. username on discord is leeovery#1110 |
https://www.dropbox.com/s/rxjad3fsr2oqocg/Screenshot%202020-06-17%2016.13.49.png?dl=0 This error shows the issue. WebStorm doesnt know where the components are and whether they exist. Prior to the recent update, this was not the case. There was no error. |
Hi, I've came up with a temporary workaround until this is fixed on the IDE level - simple nuxt module that creates
import glob from 'glob'
import { resolve, join } from 'path'
export default function ideaImportsFix () {
if (process.env.NODE_ENV === 'production') {
return
}
const components = glob.sync(join(__dirname, '../components/**/*.vue')).map(file => {
const name = file.match(/(\w*)\.vue$/)[1]
return { name, file }
})
const getComponents = () => components
this.addTemplate({
src: resolve(__dirname, './templates', 'components.js'),
fileName: '../.components.gen.js',
options: { getComponents },
})
}
<%= options.getComponents().map(({ name, file }) => {
return `import ${name} from '${file}'`
}).join('\n') %>
<%= options.getComponents().map(({ name, file }) => {
return `Vue.component('${name}', ${name})`
}).join('\n') %>
export default {
buildModules: [
'~/modules/idea-imports-fix.js'
]
}
|
@grunghi Thank you very much for these snippets! I extended it a bit (I do not know much about nodeJs, just wanted to get it done): I copied all the functions from this module (de-typescripted them):
And altered the component.js template file to:
Finally webstorm is usable again. Once the file is imported you have to right click on it and select "inspect code" otherwise wouldn't work for me |
@grunghi this is excellent work and would make a nice nuxt module until JetBrains does something! |
For those looking for a solution: Nuxt-storm |
Prior to the recent update webstorm was able to index and resolve the components when being auto imported.
Now we seem to be getting the squiggly line error saying webstorm cannot find the component.
Before it could but cmd clicking took you to the index where all the components are registered. But this was better than no cmd click functionality at all.
Thanks
Lee
The text was updated successfully, but these errors were encountered: