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
PhpStorm: Unresolved method or function setOutputPath() #151
Comments
I've also noticed this (I use PhpStorm). Can we add some custom JS doc to the exported Proxy to hint to the IDE about the methods? We could even possibly auto-generate these docs. |
Doing something like that seems to actually work: class Encore {
/**
* @returns {Encore}
*/
method1() {
// (...)
return this;
}
/**
* @param {string} test
* @returns {Encore}
*/
method2(test) {
// (...)
return this;
}
/**
* @param {string} test
* @returns {void}
*/
method3(test) {
// (...)
}
}
/**
* @type {Encore}
*/
module.exports = new Proxy(
new API(),
{ /* ... */ }
); So we'd need to:
|
That sounds great! Nice find! I had just started to look into https://github.com/DefinitelyTyped/DefinitelyTyped - i.e. you can create a typescript definition (https://www.npmjs.com/package/@types/webpack) and as soon as it's present, your editor uses it for auto-completion. Pretty cool... but it seems that your solution will work perfectly and is quite simple. |
Hi, is there any update on this issue? I could try but I'm not node expert, so not sure if it would be of any help at all. @Lyrkan the steps you mentioned, are they still valid ? I could try and do something 🙂 |
Do it! I’m sure those steps are still valid - so this is just a chore we need to get done :) |
…orentdestremau) This PR was squashed before being merged into the master branch (closes #263). Discussion ---------- Updated Encore object to class for proxy typehinting Hello, I'm trying to address #151 with this PR. I have an error in my tests: ``` Public API setOutputPath Error: Encore.configureRuntimeEnvironment is not a recognized property or method. - index.js:942 Object.get /home/florent/dev/opensource/webpack-encore/index.js:942:27 - index.js:17 Context.beforeEach /home/florent/dev/opensource/webpack-encore/test/index.js:17:13 - runnable.js:348 callFn [webpack-encore]/[mocha]/lib/runnable.js:348:21 - runnable.js:340 Hook.Runnable.run [webpack-encore]/[mocha]/lib/runnable.js:340:7 - runner.js:309 next [webpack-encore]/[mocha]/lib/runner.js:309:10 - runner.js:339 Immediate.<anonymous> [webpack-encore]/[mocha]/lib/runner.js:339:5 - timers.js:789 runCallback ``` I'm looking into it but any advice would be welcome so that we all get a proper proxy and autocomplete on :heart: *PHPSTORM* :heart: Commits ------- fb7498d Initiated class in proxy, uniformized @returns 79dbee8 Updated Encore object to class for proxy typehinting
Fixed by #263 (make sure your PhpStorm is configured to use ES6 and not ES5), thank you @florentdestremau :) |
I also get this error, but only on one of my two projects. In my first project (symfony 3 without flex), setOutputPath is correctly resolved. I checked both of my projects and noticed that when I install Encore only with npm (or yarn) i get the 0.19.0 version. But if I install it with flex, I get the 0.17.0 version, and if I forced it to the 0.1.9.0 in my packages.js, the issue is solved. Hope it helps others. |
Thanks for making Encore.
I've done the following:
In
webpack.config.js
, PhpStorm is showing the warning "Unresolved method or function setOutputPath()":I've verified that
setOutputPath()
exists innode_modules/@symfony/webpack-encore/index.js
.How can I tell PhpStorm where to find the Encore functions?
The text was updated successfully, but these errors were encountered: