I’m using Aurelia with webpack and import a json file using TypeScript’s resolveJSONModule compiler option as follow
{
“compilerOptions”: {
“resolveJsonModule”: true,
“esModuleInterop”: true
}
}.
In my TypeScript starts
import myJSON from ‘./someData.json’
This is great so far, however, I want the json file to be an external dependency, that is not bundle it. This is so I can amend the file with various settings in my CI/CD process outside of using the environment.ts file.
My desired behaviour works without any further changes in Angular but there doesn’t seem to be a clear way in Aurelia.
Can anyone tell me how to go about setting up Webpack to do as I want, thanks?
I was using the Webpack terminology external dependency for a file that is not bundled. In my case I want the json file to be treated like a static file from which I can retrieve its contents elsewhere in the app.
It’s still unclear to me if the json file will be available by the time you run au build --env prod. Will it be available? If so, you can employ aliasing with Webpack, otherwise, you will have to get it via fetch call