Skip to content

Commit 5cb24ed

Browse files
committed
fix(core): improve error message when mixing nightly and stable packages
When a plugin version mismatch occurs due to mixing nightly and stable Parcel packages, the error now includes a hint explaining the issue and suggesting to use either all nightly or all stable versions. Fixes #7946
1 parent 5948485 commit 5cb24ed

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

packages/core/core/src/loadParcelPlugin.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,23 @@ export default async function loadPlugin<T>(
202202
),
203203
);
204204
let pkgContents = await options.inputFS.readFile(pkgFile, 'utf8');
205+
206+
let hints = [];
207+
let isPluginNightly = parcelVersionRange.includes('nightly');
208+
let isParcelNightly = PARCEL_VERSION.includes('nightly');
209+
if (isPluginNightly !== isParcelNightly) {
210+
hints.push(
211+
isParcelNightly
212+
? 'You are using a nightly version of Parcel. Install nightly versions of all Parcel plugins, or switch to stable releases for everything.'
213+
: 'The plugin requires a nightly version of Parcel. Install stable versions of all Parcel packages, or switch to nightly releases for everything.',
214+
);
215+
}
216+
205217
throw new ThrowableDiagnostic({
206218
diagnostic: {
207219
message: md`The plugin "${pluginName}" is not compatible with the current version of Parcel. Requires "${parcelVersionRange}" but the current version is "${PARCEL_VERSION}".`,
208220
origin: '@parcel/core',
221+
hints,
209222
codeFrames: [
210223
{
211224
filePath: pkgFile,

0 commit comments

Comments
 (0)