Encore.setOutputPath() 尚无法调用,因为运行时环境似乎尚未配置
Encore.setOutputPath() cannot be called yet because the runtime environment doesn't appear to be configured
我正在设置 webpack.config.js 但我错过了 setOutputPath()
函数
发出的警告 PhpStorm 消息
我有 PhpStorm 2018.3.2 版本,我在 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();
PHPStorm 目前不支持 webpack-encore。
请参阅 https://github.com/symfony/webpack-encore/issues/236#issuecomment-438620314 and other comments in https://github.com/symfony/webpack-encore/issues/236 了解可能的解决方法。
It fails because the Encore Runtime Environment is only configured
when you are running it (e.g. when executing yarn encore dev
). Fix
this issue calling to Encore.isRuntimeEnvironmentConfigured()
and
Encore.configureRuntimeEnvironment()
methods:
// webpack.config.js
const Encore = require('@symfony/webpack-encore')
if (!Encore.isRuntimeEnvironmentConfigured()) {
Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
}
// ... the rest of the Encore configuration
我正在设置 webpack.config.js 但我错过了 setOutputPath()
函数
我有 PhpStorm 2018.3.2 版本,我在 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();
PHPStorm 目前不支持 webpack-encore。
请参阅 https://github.com/symfony/webpack-encore/issues/236#issuecomment-438620314 and other comments in https://github.com/symfony/webpack-encore/issues/236 了解可能的解决方法。
It fails because the Encore Runtime Environment is only configured when you are running it (e.g. when executing
yarn encore dev
). Fix this issue calling toEncore.isRuntimeEnvironmentConfigured()
andEncore.configureRuntimeEnvironment()
methods:
// webpack.config.js
const Encore = require('@symfony/webpack-encore')
if (!Encore.isRuntimeEnvironmentConfigured()) {
Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
}
// ... the rest of the Encore configuration