Created
January 5, 2018 08:22
Symfony Encore trick for completion in PHPStorm (Can't analyse webpack.config.js)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
let config = Encore.getWebpackConfig(); | |
if(!Encore.isProduction()) { | |
fs.writeFile("fakewebpack.config.js", "module.exports = "+JSON.stringify(config), function(err) { | |
if(err) { | |
return console.log(err); | |
} | |
console.log("fakewebpack.config.js written"); | |
}); | |
} | |
module.exports = config; | |
// Then in PhpStorm webpack settings, point to the fakewebpack.config.js file |
A great trick: it works!!! Many many thankyou!
The trick works great after changing the default webpack.config.js
to fakewebpackconfig.js
in Preferences > Languages & Framework > JavaScript > Webpack
.
Then yarn encore dev
is required to generate the file with the compiled config.
There is a linked issue on symfony/webpack-encore#236
This solution has some drawbacks: read symfony/webpack-encore#236 (comment) for more information.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
fs must be included.
var fs = require("fs");