CMSgov / design-system

Open source design and front-end development resources for creating Section 508 compliant, responsive, and consistent websites.
https://design.cms.gov
Other
320 stars 87 forks source link

Project no longer compiles using CMSDS v2.2.1 #911

Closed pwolfert closed 3 years ago

pwolfert commented 3 years ago

Describe the bug Project no longer compiles after upgrading due to missing dependency.

Compiling with babel produces the following error:

Failed to compile.

./node_modules/@cmsgov/design-system/dist/esnext/Tooltip/Tooltip.js
Module not found: Can't resolve 'core-js/modules/es.array.find' in '<project path>/node_modules/@cmsgov/design-system/dist/esnext/Tooltip'
Compiling...
Failed to compile.

./node_modules/@cmsgov/design-system/dist/esnext/Tooltip/Tooltip.js
Module not found: Can't resolve 'core-js/modules/es.array.find' in '<project path>/node_modules/@cmsgov/design-system/dist/esnext/Tooltip'

where <project path> is the path on my local filesystem.

To Reproduce Message me directly for instructions on how to check out example branch.

Expected behavior @cmsgov/design-system should probably have its expected version of core-js explicitly listed as a dependency.

What is happening for our project is that we have other dependencies that require older versions of core-js, and the older version wins out in our package manager's resolution algorithm. Below is output from yarn explaining why 2.6.11 is being used. I want to note that in another one of our projects we sucessfully compiled version CMSDS 2.2.1 because it didn't have any other dependencies that wanted an older version. In this other project it resolved to core-js version 3.6.5, and babel was happy.

=> Found "core-js@2.6.11"
info Has been hoisted to "core-js"
info Reasons this module exists
   - Hoisted from "flow-typed#@babel#polyfill#core-js"
   - Hoisted from "pet-shared-components#react-bootstrap#@babel#runtime-corejs2#core-js"
   - Hoisted from "react-scripts#workbox-webpack-plugin#workbox-build#strip-comments#babel-plugin-transform-object-rest-spread#babel-runtime#core-js"
info Disk size without dependencies: "7.68MB"
info Disk size with unique dependencies: "7.68MB"
info Disk size with transitive dependencies: "7.68MB"
info Number of shared dependencies: 0
=> Found "react-app-polyfill#core-js@3.6.5"
info This module exists because "react-app-polyfill" depends on it.
info Disk size without dependencies: "7.13MB"
info Disk size with unique dependencies: "7.13MB"
info Disk size with transitive dependencies: "7.13MB"
info Number of shared dependencies: 0
=> Found "marketplace-api-client#core-js@3.6.5"
info This module exists because "marketplace-api-client" depends on it.
info Disk size without dependencies: "7.13MB"
info Disk size with unique dependencies: "7.13MB"
info Disk size with transitive dependencies: "7.13MB"
info Number of shared dependencies: 0
=> Found "fbjs#core-js@1.2.7"
info This module exists because "react-json-view#flux#fbjs" depends on it.
info Disk size without dependencies: "4.37MB"
info Disk size with unique dependencies: "4.37MB"
info Disk size with transitive dependencies: "4.37MB"
info Number of shared dependencies: 0
nichia commented 3 years ago

Tracked here: https://jira.cms.gov/browse/WNMGDS-734