The package-helper utility used for the runtime check for optional dependencies currently relies on the webpack-encore dev dependencies to get the version constraint:
|
if (packageData.enforce_version) { |
|
if (!packageJsonData.devDependencies) { |
|
logger.warning( |
|
'Could not find devDependencies key on @symfony/webpack-encore package' |
|
); |
|
|
|
return newData; |
|
} |
|
|
|
// this method only supports devDependencies due to how it's used: |
|
// it's mean to inform the user what deps they need to install |
|
// for optional features |
|
if (!packageJsonData.devDependencies[packageData.name]) { |
|
throw new Error(`Could not find package ${packageData.name}`); |
|
} |
|
|
|
newData.version = packageJsonData.devDependencies[packageData.name]; |
|
delete newData['enforce_version']; |
The actual standard way to define a range for those dependencies that are installed by the parent package (i.e. the project in the case of Encore) is to define them as peer dependencies. Encore is defining them properly since version 4.0 but the runtime check is still using devDependencies.
The
package-helperutility used for the runtime check for optional dependencies currently relies on the webpack-encore dev dependencies to get the version constraint:webpack-encore/lib/package-helper.js
Lines 189 to 206 in 6b4ed49
The actual standard way to define a range for those dependencies that are installed by the parent package (i.e. the project in the case of Encore) is to define them as peer dependencies. Encore is defining them properly since version 4.0 but the runtime check is still using
devDependencies.