Skip to content

feat(webpack + vite): Ensure that bundlers respect catalog dependencies#1654

Merged
andrii-bodnar merged 1 commit into
lingui:mainfrom
timofei-iatsenko:fix/add-catalog-deps-for-loader
May 16, 2023
Merged

feat(webpack + vite): Ensure that bundlers respect catalog dependencies#1654
andrii-bodnar merged 1 commit into
lingui:mainfrom
timofei-iatsenko:fix/add-catalog-deps-for-loader

Conversation

@timofei-iatsenko
Copy link
Copy Markdown
Collaborator

@timofei-iatsenko timofei-iatsenko commented May 15, 2023

Description

Catalog compiler operates on a bunch of files when compiling one catalog (template + fallbacks + source language). Loaders in bundlers expecting deterministic results, meaning for the same source it should always produce the same result.

Currently, implementation of webpack loader / vite plugin does not respect catalog dependencies. That breaks caching in Webpack and watch mode (catalog will not be rebuilt if one of the dependencies changed)

This PR brings tracking of all catalog dependencies and should resolve mentioned issues.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Fixes # (issue)

Checklist

  • I have read the CONTRIBUTING and CODE_OF_CONDUCT docs
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@vercel
Copy link
Copy Markdown

vercel Bot commented May 15, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
js-lingui ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 16, 2023 7:24am

Copy link
Copy Markdown
Contributor

@andrii-bodnar andrii-bodnar left a comment

Choose a reason for hiding this comment

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

@thekip thank you! Please rebase the branch, there was an issue before in the main branch

@timofei-iatsenko timofei-iatsenko force-pushed the fix/add-catalog-deps-for-loader branch from fba79ef to 45a222d Compare May 16, 2023 07:20
@timofei-iatsenko timofei-iatsenko changed the title feature(webpack + vite): Ensure that bundlers respect catalog dependencies feat(webpack + vite): Ensure that bundlers respect catalog dependencies May 16, 2023
@github-actions
Copy link
Copy Markdown

size-limit report 📦

Path Size
./packages/core/dist/index.mjs 1.43 KB (0%)
./packages/detect-locale/dist/index.mjs 721 B (0%)
./packages/react/dist/index.mjs 1.59 KB (0%)
./packages/remote-loader/dist/index.mjs 7.24 KB (0%)

@codecov
Copy link
Copy Markdown

codecov Bot commented May 16, 2023

Codecov Report

Patch coverage: 92.00% and project coverage change: +0.08 🎉

Comparison is base (e5b7d1c) 75.40% compared to head (45a222d) 75.48%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1654      +/-   ##
==========================================
+ Coverage   75.40%   75.48%   +0.08%     
==========================================
  Files          77       79       +2     
  Lines        1996     2011      +15     
  Branches      516      518       +2     
==========================================
+ Hits         1505     1518      +13     
- Misses        377      379       +2     
  Partials      114      114              
Impacted Files Coverage Δ
packages/vite-plugin/src/index.ts 0.00% <0.00%> (ø)
packages/cli/src/api/catalog.ts 91.91% <100.00%> (ø)
...es/cli/src/api/catalog/getCatalogDependentFiles.ts 100.00% <100.00%> (ø)
...es/cli/src/api/catalog/getFallbackListForLocale.ts 100.00% <100.00%> (ø)
...s/cli/src/api/catalog/getTranslationsForCatalog.ts 96.15% <100.00%> (-0.28%) ⬇️
packages/loader/src/webpackLoader.ts 90.90% <100.00%> (+2.02%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@andrii-bodnar andrii-bodnar merged commit b5083d1 into lingui:main May 16, 2023
@timofei-iatsenko timofei-iatsenko deleted the fix/add-catalog-deps-for-loader branch May 16, 2023 07:55
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