Skip to content
GitLab
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
  • !2714

Import scripts in Service Worker

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/piotr-cz/feature/customize-sw into master Jul 03, 2017
  • Overview 23
  • Commits 1
  • Pipelines 0
  • Changes 2

Created by: piotr-cz

This PR adds an ability to use importScripts option of SWPrecacheWebpackPlugin.

How-to:

  1. create a file called public/service-worker-import.js
  2. run npm run build
  3. check that file has been loaded (either in console network panel or by placing console.log statement inside and checking for output) by refreshing the page

File is being imported only on service worker install/ update.

Downsides:

  • It's possible to import only one file and it's name is harcoded
  • File is not being passed trough plugins (minification, etc)

Fixes: #2253 (closed)

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/piotr-cz/feature/customize-sw