Search code examples
reactjswebpackphpstormwebstorm

Encore.setOutputPath() cannot be called yet because the runtime environment doesn't appear to be configured


I'm setting webpack.config.js but I miss that warning PhpStorm message by the setOutputPath() function

I have the version 2018.3.2 of PhpStorm, and I am working in Linux Debian

let Encore = require('@symfony/webpack-encore');

Encore
    .setOutputPath('public/build/')
    .setPublicPath('/build')
    .addEntry('app', './assets/js/app.js')
    .splitEntryChunks()
    .enableSingleRuntimeChunk()
    .cleanupOutputBeforeBuild()
    .enableBuildNotifications()
    .enableSourceMaps(!Encore.isProduction())
    .enableVersioning(Encore.isProduction())
    .enableReactPreset()
    .configureBabel(function (babelConfig) {
        babelConfig.presets.push('@babel/preset-flow');
        babelConfig.plugins.push("@babel/plugin-proposal-class-properties");
        babelConfig.plugins.push('styled-jsx/babel');
    });

module.exports = Encore.getWebpackConfig();

Solution

  • PHPStorm doesn't currently support webpack-encore.

    Please see https://github.com/symfony/webpack-encore/issues/236#issuecomment-438620314 and other comments in https://github.com/symfony/webpack-encore/issues/236 for possible workarounds.