R
R
Renhor2019-05-26 20:03:32
phpstorm
Renhor, 2019-05-26 20:03:32

Nuxt.js in PHPStorm, how to set up?

They are mainly interested in the method hinter in nuxt (middleware() for example) and that the storm would learn to understand and suggest paths starting with ~/@ (in nuxt this is the root directory).
Well, he does not particularly see imports. That is, I imported some module, let's say modal,
of course it suggests modal, but its properties and methods are no longer there.
Vue without nuxt - everything works fine, but not without nuxt :)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
its2easyy, 2019-05-27
@Renhor

I found how to force ~/@ aliases to be taken into account, you need to create a js file with content

const path = require('path')
module.exports = {
  resolve: {
    extensions: ['.js', '.json', '.vue', '.ts'],
    root: path.resolve(__dirname),
    alias: {
      '@': path.resolve(__dirname),
      '~': path.resolve(__dirname),
    },
  },
}

and save to the root with the name webpack.config.js, or with any other name, and then in phpstorm in settings - languages ​​& framework - javascript - webpack select this created file. The file can then be added to gitignore.
https://github.com/nuxt/nuxt.js/issues/1881#issuec...

S
Sabah, 2020-08-28
@Sabah

In PHPSTORM go to Settings/Languages ​​& Frameworks/JavaScript/Webpack
specify the path for Webpack configuration file:
/node_modules/nuxt/webpack.config.js

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question