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

Feature/migrate to esbuild #810

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ node_modules
npm-debug.log
testem.log
/typings
.nx

# e2e
/e2e/*.js
Expand Down
10 changes: 5 additions & 5 deletions HOW_TO.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ ng add ngx-bootstrap

### How to install Angular Material

Replace temporarily custom builders by default ones in `angular.json`
Temporarily replace custom builders by default ones in `angular.json`

@angular-builders/custom-webpack:browser => @angular-devkit/build-angular:browser \
@angular-builders/custom-webpack:dev-server => @angular-devkit/build-angular:dev-server
@angular-builders/custom-esbuild:browser => @angular-devkit/build-angular:browser \
@angular-builders/custom-esbuild:dev-server => @angular-devkit/build-angular:dev-server

Add Angular Material using `ng add` command:

Expand All @@ -35,5 +35,5 @@ Angular Material Library is now installed in your project.

Put back custom builders in `angular.json`

@angular-devkit/build-angular:browser => @angular-builders/custom-webpack:browser \
@angular-devkit/build-angular:dev-server => @angular-builders/custom-webpack:dev-server
@angular-devkit/build-angular:browser => @angular-builders/custom-esbuild:browser \
@angular-devkit/build-angular:dev-server => @angular-builders/custom-esbuild:dev-server
32 changes: 10 additions & 22 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-builders/custom-webpack:browser",
"builder": "@angular-builders/custom-esbuild:application",
"options": {
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"browser": "src/main.ts",
"polyfills": ["src/polyfills.ts"],
"tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
Expand All @@ -38,11 +38,7 @@
"styles": [
"src/styles.scss"
],
"scripts": [],
"customWebpackConfig": {
"path": "./angular.webpack.js",
"replaceDuplicatePlugins": true
}
"scripts": []
},
"configurations": {
"dev": {
Expand All @@ -52,8 +48,6 @@
"namedChunks": false,
"aot": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": false,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
Expand All @@ -68,8 +62,6 @@
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
Expand All @@ -84,8 +76,6 @@
"namedChunks": false,
"aot": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": false,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
Expand All @@ -100,8 +90,6 @@
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
Expand All @@ -112,22 +100,22 @@
}
},
"serve": {
"builder": "@angular-builders/custom-webpack:dev-server",
"builder": "@angular-builders/custom-esbuild:dev-server",
"options": {
"browserTarget": "angular-electron:build"
"buildTarget": "angular-electron:build"
},
"configurations": {
"dev": {
"browserTarget": "angular-electron:build:dev"
"buildTarget": "angular-electron:build:dev"
},
"production": {
"browserTarget": "angular-electron:build:production"
"buildTarget": "angular-electron:build:production"
},
"web": {
"browserTarget": "angular-electron:build:web"
"buildTarget": "angular-electron:build:web"
},
"web-production": {
"browserTarget": "angular-electron:build:web-production"
"buildTarget": "angular-electron:build:web-production"
}
}
},
Expand Down
32 changes: 0 additions & 32 deletions angular.webpack.js

This file was deleted.

4 changes: 2 additions & 2 deletions app/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ function createWindow(): BrowserWindow {
// Path when running electron executable
let pathIndex = './index.html';

if (fs.existsSync(path.join(__dirname, '../dist/index.html'))) {
if (fs.existsSync(path.join(__dirname, '../dist/browser/index.html'))) {
// Path when running electron in local folder
pathIndex = '../dist/index.html';
pathIndex = '../dist/browser/index.html';
}

const url = new URL(path.join('file:', __dirname, pathIndex));
Expand Down
6 changes: 3 additions & 3 deletions electron-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
"!package.json",
"!package-lock.json",
{
"from": "../dist",
"from": "../dist/browser",
"filter": ["**/*"]
}
],
"win": {
"icon": "dist/assets/icons",
"icon": "dist/browser/assets/icons",
"target": [
"portable"
]
},
"portable": {
"splashImage": "dist/assets/icons/electron.bmp"
"splashImage": "dist/browser/assets/icons/electron.bmp"
},
"mac": {
"icon": "dist/assets/icons",
Expand Down
Loading
Loading