Reputation: 1676
I need my file firebase-messaging-sw.ts compiled to firebase-messaging-sw.js to be accessible from the root.
I already created firebase-messaging-sw.ts in the src folder. But that doesn't work. I also added the .js file in angular.json.
So what I want is to make a ts file and compile it to js. But I don't know how to do it in Angular.
angular.json
"assets": [
"src/favicon.ico",
"src/assets",
"src/firebase-messaging-sw.js"
Upvotes: 4
Views: 1572
Reputation: 28128
You can always use
tsc myfile.ts
to compile a separate .ts
file to a separate .js
file, that has nothing to do with your Angular project.
Perhaps you can even run both commands at the same time in the terminal:
Terminal
tsc myfile.ts && ng build myproject
Or add it to package.json
"scripts":{
"build" : "tsc myfile.ts && ng build myproject"
}
npm run build
Upvotes: 6