Is there a simpler way to tell NX/Angular to compile the app + an extra file separately?
Currently, I have been running 2 npm scripts:
nx build client-extension && npm run client-extension:injector
However, this method creates extra hassle and prevents 'watch' from working properly. I am aware of options like custom webpack configs, but I'm looking for a more straightforward solution.
I have considered exploiting the logic used for Angular worker files, which result in separate .js files. But that approach doesn't seem ideal either.
This is my current project.json configuration:
{
"name": "client-extension",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"prefix": "candlejumper",
"sourceRoot": "apps/client-extension/src",
"tags": [],
"targets": {
"build": {
"executor": "@angular-devkit/build-angular:application",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/apps/client-extension",
"index": "apps/client-extension/src/index.html",
"browser": "apps/client-extension/src/main.ts",
"polyfills": ["zone.js"],
"tsConfig": "apps/client-extension/tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": ["apps/client-extension/src/favicon.ico", "apps/client-extension/src/assets", "apps/client-extension/src/manifest.json"],
"styles": ["apps/client-extension/src/style/styles.scss"]
},
In essence, I would like to enhance the project.json with an option like:
{
"extraFiles": ["./my-second-entry.ts"]
}