From 786bd11763297e3f5516e09438da819e82537024 Mon Sep 17 00:00:00 2001 From: Tristan Date: Mon, 17 Jan 2022 03:21:48 -0500 Subject: [PATCH] temp fix: resolve mini-css-extractor-plugin to an older version for cra-template & projects-test (#21295) * temp fix: resolve mini-css-extractor-plugin to older version * Change files * add temp fix to northstar projects test * remove console log --- ...cra-template-69213d33-73e4-4b2f-b41a-09cc17439a07.json | 7 +++++++ packages/cra-template/scripts/test.ts | 8 ++++++++ packages/fluentui/projects-test/src/createReactApp.ts | 8 ++++++++ 3 files changed, 23 insertions(+) create mode 100644 change/@fluentui-cra-template-69213d33-73e4-4b2f-b41a-09cc17439a07.json diff --git a/change/@fluentui-cra-template-69213d33-73e4-4b2f-b41a-09cc17439a07.json b/change/@fluentui-cra-template-69213d33-73e4-4b2f-b41a-09cc17439a07.json new file mode 100644 index 0000000000000..d4370ae6044ef --- /dev/null +++ b/change/@fluentui-cra-template-69213d33-73e4-4b2f-b41a-09cc17439a07.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "temp fix: resolve mini-css-extractor-plugin to older version to fix error.", + "packageName": "@fluentui/cra-template", + "email": "tristan.watanabe@gmail.com", + "dependentChangeType": "none" +} diff --git a/packages/cra-template/scripts/test.ts b/packages/cra-template/scripts/test.ts index ca6f9ab63867c..ee3a311ce1277 100644 --- a/packages/cra-template/scripts/test.ts +++ b/packages/cra-template/scripts/test.ts @@ -77,6 +77,14 @@ async function runE2ETest() { logger('STEP 2. Create test React app from template'); await prepareCreateReactApp(tempPaths, `file:${templatePath}`); + /** + * This is a temporary quick-fix solution. Remove once issue with mini-css-extract-plugin + * is resolved @see https://github.com/facebook/create-react-app/issues/11930 + */ + const parsedJSON = JSON.parse(fs.readFileSync(`${tempPaths.testApp}/package.json`, 'utf-8')); + parsedJSON.resolutions['mini-css-extract-plugin'] = '2.4.5'; + fs.writeFileSync(`${tempPaths.testApp}/package.json`, JSON.stringify(parsedJSON)); + await shEcho('yarn add cross-env', tempPaths.testApp); logger(`✔️ Test React app is successfully created: ${tempPaths.testApp}`); diff --git a/packages/fluentui/projects-test/src/createReactApp.ts b/packages/fluentui/projects-test/src/createReactApp.ts index 2088648b409ee..ba33bfa564f72 100644 --- a/packages/fluentui/projects-test/src/createReactApp.ts +++ b/packages/fluentui/projects-test/src/createReactApp.ts @@ -37,6 +37,14 @@ export async function createReactApp() { const packedPackages = await packProjectPackages(logger, config.paths.packages(), ['@fluentui/react-northstar']); await addResolutionPathsForProjectPackages(testAppPath()); + /** + * This is a temporary quick-fix solution. Remove once issue with mini-css-extract-plugin + * is resolved @see https://github.com/facebook/create-react-app/issues/11930 + */ + const parsedJSON = JSON.parse(fs.readFileSync(`${tempPaths.testApp}/package.json`, 'utf-8')); + parsedJSON.resolutions['mini-css-extract-plugin'] = '2.4.5'; + fs.writeFileSync(`${tempPaths.testApp}/package.json`, JSON.stringify(parsedJSON)); + await shEcho(`yarn add ${packedPackages['@fluentui/react-northstar']}`, testAppPath()); logger(`✔️ Fluent UI packages were added to dependencies`);