Thanks to visit codestin.com
Credit goes to github.com

Skip to content

The runtime version check for optional dependencies should use peer dependencies for the supported versions #1413

@stof

Description

@stof

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions