Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update loom to v1 #4544

Merged
merged 2 commits into from
Oct 28, 2021
Merged

Update loom to v1 #4544

merged 2 commits into from
Oct 28, 2021

Conversation

BPScott
Copy link
Member

@BPScott BPScott commented Oct 25, 2021

WHY are these changes introduced?

Updating loom to v1

WHAT is this pull request doing?

  • Updating Loom to v1
  • Updating loom config
  • Updating config helpers to be pure cjs. This isn't strictly needed but they they did that mismash thing where they used require() and export and thus mixed cjs and esm and relied on transpiling to sort it out which i think is silly.

How to 🎩

  • Do a build on the main branch and then move it to a temporary place with mv build build-og
  • Checkout this branch run yarn to update dependencies, run a yarn clean to delete the build folder
  • Run yarn build to generate a new build
  • Run diff -ru -x '*.tsbuildinfo' build-og build to compare the old and new build output.

What about loom-plugin-build-extended?

An excellent question, how good of you to ask. loom-plugin-build-extended includes support for loading scss files using node-sass. Its rollup plugin for handling styles is based upon the styles rollup plugin in polaris-react. However I am choosing not to remove this repo's styles plugin in favour of loom-plugin-build-extended.

This is because we're intending to replace node-sass with dart-sass in loom-plugin-build-extended in the near future. For most projects, that's completely fine - they fix any migration from node-sass to dart-sass and they're good. However polaris-react ships a sass public api that needs to be understandable in apps that use node-sass (as sewing-kit still ships with node-sass) and within the polaris-react codebase.

Migrating this codebase to dart-sass is possible, however it raises deprecation warnings in the publicly used functions that can only be fixed by migrating the codebase to dart-sass and those changes will throw errors when used by apps that leverage node-sass.

In order to migrate this codebase to dart-sass we need to either: remove the public sass API, or make sure that all consuming apps have migrated to use dart-sass using sewing-kit's dartSassLoader experiment (this is huge effort and a pain, just remove the public sass api please).

In order to not be in a place where this codebase is constantly raising deprecation warnings that can't be fixed without breaking consumers it's better to leave polaris-react using node-sass for the time being. Which means sticking with it having its own style loader.

@caution-tape-bot
Copy link

👋 It looks like you're updating JavaScript packages that are known
to cause problems when duplicated.

You can deduplicate them with the yarn-deduplicate utility:

npx yarn-deduplicate --packages graphql react react-dom webpack
npx yarn-deduplicate --scopes @shopify @apollo

A duplicate React version may cause an invalid hook call warning.

React context providers usually use module-scoped globals as their
default context values. Multiple versions of such packages will yield
multiple global instances, resulting in oblique runtime errors.

@github-actions
Copy link
Contributor

size-limit report

Path Size
cjs 163.38 KB (0%)
esm 96.12 KB (0%)
esnext 143.03 KB (0%)
css 34.52 KB (0%)

// them to work here either
configuration.jestModuleMapper?.hook((moduleMapper) => {
// them to work in jest tests either
configuration.jestModuleNameMapper?.hook((moduleMapper) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should everything else follow suit moduleMapper => moduleNameMapper

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the naming of the argument isn't suuuper important as it's highly localised. I think leaving as moduleMapper gets the point across.

Copy link

@dahukish dahukish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small comment, but :shipit:

@BPScott BPScott merged commit ec0059e into main Oct 28, 2021
@BPScott BPScott deleted the loom-v1 branch October 28, 2021 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants