From c97bb1e0fdd797120396855521c24f84a7c02d5a Mon Sep 17 00:00:00 2001 From: Paul Soporan Date: Thu, 10 Sep 2020 23:57:24 +0300 Subject: [PATCH 1/4] fix: use require.resolve when resolving default config --- packages/core/parcel/src/cli.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/parcel/src/cli.js b/packages/core/parcel/src/cli.js index 240e939ce3c..0b6c8904f3b 100755 --- a/packages/core/parcel/src/cli.js +++ b/packages/core/parcel/src/cli.js @@ -178,7 +178,7 @@ async function run(entries: Array, command: any) { let parcel = new Parcel({ entries, packageManager, - defaultConfig: '@parcel/config-default', + defaultConfig: require.resolve('@parcel/config-default'), patchConsole: true, ...options, }); From 32b193e90db02adc702561c4dfe1d242c7ac61dd Mon Sep 17 00:00:00 2001 From: Paul Soporan Date: Fri, 11 Sep 2020 16:49:02 +0300 Subject: [PATCH 2/4] refactor: look in cwd first when resolving the default config --- packages/core/parcel/src/cli.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/core/parcel/src/cli.js b/packages/core/parcel/src/cli.js index ddf80f1e9b2..07f8a95ee7f 100755 --- a/packages/core/parcel/src/cli.js +++ b/packages/core/parcel/src/cli.js @@ -174,11 +174,12 @@ async function run(entries: Array, command: any) { } let Parcel = require('@parcel/core').default; let options = await normalizeOptions(command); - let packageManager = new NodePackageManager(new NodeFS()); + let fs = new NodeFS(); + let packageManager = new NodePackageManager(fs); let parcel = new Parcel({ entries, packageManager, - defaultConfig: require.resolve('@parcel/config-default'), + defaultConfig: require.resolve('@parcel/config-default', { paths: [fs.cwd(), __dirname] }), patchConsole: true, ...options, }); From 985a894edd05f3381baba922b915998c24200e23 Mon Sep 17 00:00:00 2001 From: Paul Soporan Date: Fri, 11 Sep 2020 18:23:30 +0300 Subject: [PATCH 3/4] chore: add $FlowFixMe --- packages/core/parcel/src/cli.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/core/parcel/src/cli.js b/packages/core/parcel/src/cli.js index 07f8a95ee7f..64dc71eadde 100755 --- a/packages/core/parcel/src/cli.js +++ b/packages/core/parcel/src/cli.js @@ -179,6 +179,7 @@ async function run(entries: Array, command: any) { let parcel = new Parcel({ entries, packageManager, + // $FlowFixMe - flow doesn't know about the `paths` option (added in Node v8.9.0) defaultConfig: require.resolve('@parcel/config-default', { paths: [fs.cwd(), __dirname] }), patchConsole: true, ...options, From e01544961808ee5ce33d545fb3092b6dae938b10 Mon Sep 17 00:00:00 2001 From: Paul Soporan Date: Fri, 11 Sep 2020 18:47:47 +0300 Subject: [PATCH 4/4] style: run prettier --- packages/core/parcel/src/cli.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/core/parcel/src/cli.js b/packages/core/parcel/src/cli.js index 64dc71eadde..6856bc55705 100755 --- a/packages/core/parcel/src/cli.js +++ b/packages/core/parcel/src/cli.js @@ -180,7 +180,9 @@ async function run(entries: Array, command: any) { entries, packageManager, // $FlowFixMe - flow doesn't know about the `paths` option (added in Node v8.9.0) - defaultConfig: require.resolve('@parcel/config-default', { paths: [fs.cwd(), __dirname] }), + defaultConfig: require.resolve('@parcel/config-default', { + paths: [fs.cwd(), __dirname], + }), patchConsole: true, ...options, });