Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular quick start template (TS) #562

Open
4 tasks done
stemyke opened this issue Jul 15, 2024 · 3 comments
Open
4 tasks done

Angular quick start template (TS) #562

stemyke opened this issue Jul 15, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@stemyke
Copy link

stemyke commented Jul 15, 2024

Clear and concise description of the problem

Hello!

I successfully integrated Angular to electron-vite using the plugin: "@analogjs/vite-plugin-angular": "1.6.1"

How can I contribute to create a quick start template for it for people who would want to use Angular like myself?

Suggested solution

These are the needed dependencies for build:

  • "@angular-devkit/build-angular": "17.3.8",
  • "@angular/cli": "17.3.8",
  • "@angular/compiler-cli": "17.3.11",
  • "@analogjs/vite-plugin-angular": "1.6.1",
  • "@angular/common": "17.3.11",
  • "@angular/compiler": "17.3.11",
  • "@angular/core": "17.3.11"

Based on the react example I only modified the electron.vite.config.ts file a little:

import { resolve } from 'path';
import { defineConfig, externalizeDepsPlugin } from 'electron-vite';
import angular from '@analogjs/vite-plugin-angular';

export default defineConfig({
    main: {
        plugins: [externalizeDepsPlugin()]
    },
    preload: {
        plugins: [externalizeDepsPlugin()]
    },
    renderer: {
        root: resolve('src/renderer'),
        resolve: {
            alias: {
                '@renderer': resolve('src/renderer/src')
            }
        },
        plugins: angular()
    }
});

I renamed main.tsx to main.ts of course and in main.ts we could use any angular based code for example:

import 'zone.js';
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import './assets/main.scss';

import { AppModule } from './app/app.module';

enableProdMode();

platformBrowserDynamic()
    .bootstrapModule(AppModule, {
        preserveWhitespaces: false
    })
    .catch((err) => console.error(err));

Alternative

No response

Additional context

No response

Validations

@stemyke stemyke added the enhancement New feature or request label Jul 15, 2024
@wh131462
Copy link

Could I take a look at your repository for reference? I would really appreciate it.

@stemyke
Copy link
Author

stemyke commented Oct 22, 2024

@wh131462 I dont have a public repository for this, but I can send you some files.

renderer.zip

Apart from this the only files I modified are package.json and electron.vite.config.ts as I previously mentioned.

image

If you look closely there is no need for angular.json or something like in general Angular web apps.

@wh131462
Copy link

@wh131462 I dont have a public repository for this, but I can send you some files.

renderer.zip

Apart from this the only files I modified are package.json and electron.vite.config.ts as I previously mentioned.

image

If you look closely there is no need for angular.json or something like in general Angular web apps.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants