Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !8485

Add support to customize the Service Worker with InjectManifest and Workbox v5

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/marlonmleite/master into master 5 years ago
  • Overview 17
  • Commits 19
  • Pipelines 0
  • Changes 11

Created by: marlonmleite

Description

This PR originated from discussion #7966 and many issues related to Service Workers and customizations in the CRA to configure the Workbox plugin over the past last year.

With this feature after compiling the Service Worker, the compiled features are identical to the existing one. The conversion of the existing functionalities in GenerateSW to InjectManifest was carried out, respecting all existing standard configurations currently.

Why Workbox v5?

We have also taken advantage of the momentum and migrated to v5.0.0 from the Workbox, because for build the service worker with webpack, environment variables and more are only available in v5. See more.

What features?

Now, it will be possible to make any customized configuration in the Service Worker and thus make it possible to use several functionalities at the service worker level: https://github.com/facebook/create-react-app/issues/7966#issuecomment-579442388

Migrate

To update your current react-scripts to this new version, this not contain a break change. To use the configuration using InjectManifest you will need to create the sw-template.js or sw-template.ts file in your application's src/ directory.

Local test

Checkout in this branch, run the installation and bootstrap scripts and run the commands:

with cra-template:

yarn create-react-app ../sw-app --template file:./packages/cra-template

with cra-template-typescript:

yarn create-react-app ../sw-app --template file:./packages/cra-template-typescript

Live app

This is a real application created from this new functionality, it already has the service worker enabled. Look: https://test-cra-97e59.firebaseapp.com/

Activity

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
Please register or sign in to reply

There are currently no pipelines.

To run a merge request pipeline, the jobs in the CI/CD configuration file must be configured to run in merge request pipelines.

0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
2
CLA Signed tag: underlying tools
2
CLA Signed tag: underlying tools
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
0
0 participants
Reference: facebook/create-react-app!9250
Source branch: github/fork/marlonmleite/master

Menu

Explore Projects Groups Snippets