I am looking to upload a .js file example.js to Angular root and want to access it directly via localhost:3000/example.js
I have tried adding the file directly to root and also made changes to angular.json but nothing seems to work.
Is there a way to achieve this without copying the file to assets directory.
Any config changes in Angular.json
Raphaël Balet
9,1398 gold badges65 silver badges118 bronze badges
1 Answer 1
You have to add it inside your assets array, inside your angular.json file.
The file need at least to be inside your src folder though.
so this would be
src
-- assets
-- example.js
Then
"assets": [
"src/assets",
"src/example.js"
...
]
Cheers
answered Feb 6, 2024 at 12:23
Raphaël Balet
9,1398 gold badges65 silver badges118 bronze badges
Sign up to request clarification or add additional context in comments.
1 Comment
Pratik Sawant
This works on my end
lang-js