There is a file ts with the following import:
import dictJsonRu from '../../assets/i18n/ru_RU.json';
After build the browser tried to find this file on my local machine using relative path.
How to make this path absolute?
I have trie this:
import dictJsonRu from 'src/assets/i18n/ru_RU.json';
My ts config is:
"compilerOptions": {
"baseUrl": "./"
Error is:
Fetch API cannot load file:///C:/Users/O/Desktop/Projects/ka/assets/i18n/ru_RU.json. URL scheme must be "http" or "https" for CORS request.
Also I tried this:
"paths": {
"@assets*": ["src/assets/*"]
}
import dictJsonRu from '@assets/i18n/ru_RU.json';
If to set <base href="/" />
in html file I get this error:
Fetch API cannot load file:///C:/assets/i18n/ru_RU.json. URL scheme must be "http" or "https" for CORS request.
My html file looks like this:
<body>
<app-root></app-root>
<script src="http://remoteserve/mp.js"></script>
</body>
I want to find file relative this http://remoteserve/mp.js/ssets/i18n/ru_RU.json.
I use IIS, probably I can set web.config to say where to loook files when main.js is required in client?
You can try this way,
"paths": {
"@assets/*": ["src/assets/*"]
},
import dictJsonRu from '@assets/i18n/ru_RU.json';