This repository was archived by the owner on Jan 26, 2019. It is now read-only.
Description
Is this a bug report?
Yes.
Can you also reproduce the problem with npm 4.x?
Yes.
Which terms did you search for in User Guide?
tsconfig.ts
compilerOptions
Environment
npm ls react-scripts-ts
(if you haven’t ejected): -
node -v
: v10.4.1
npm -v
: 6.1.0
yarn --version
(if you use Yarn):
yarn ls react-scripts-ts
(if you haven’t ejected): -
Then, specify:
Operating system: Ubuntu 18.04 LTS
Browser and version (if relevant): Google Chrome Version 67.0.3396.87 (Official Build) (64-bit)
Steps to Reproduce
(Write your steps here:)
npx create-react-app my-app --scripts-version=react-scripts-ts
cd my-app
npm run eject
npm run build
cd build
edit tsconfig.json
and change the target
value in compilerOptions
to "ES2015"
npx http-server
In the browser run the page served by http-server
and press CTRL-SHIFT-I to see the error message in the console.
Expected Behavior
No error in the console.
Actual Behavior
This error occurs in the browser's console:
Uncaught TypeError: Assignment to constant variable.
at window.addEventListener (registerServiceWorker.ts:90)
I have found two ways to solve the problem:
do not change the target
value in compilerOptions
...
change line 37 in registerServiceWorker.ts
from:
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
to
let swUrl;
swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
Reproducible Demo
(Paste the link to an example project and exact instructions to reproduce the issue.)
👍 React with 👍 2ulrichb and mattste