Skip to content

Angular Webpack Example Broken in 19 #2045

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

Closed
1 task done
xentropy-git opened this issue Apr 26, 2025 · 2 comments · Fixed by #2047
Closed
1 task done

Angular Webpack Example Broken in 19 #2045

xentropy-git opened this issue Apr 26, 2025 · 2 comments · Fixed by #2047
Assignees
Labels
area-bundlers Related to the bundler plugins like webpack and vite area-core Related to some core parts of alphaTab platform-javascript Related to the JavaScript version of alphaTab state-accepted This is a valid topic to work on.

Comments

@xentropy-git
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Angular webpack example is outdated and doesn't work for Angular 19.

Expected Behavior

I'm guessing there as a breaking change in angular-builders/custom-webpack

Steps To Reproduce

Clone the project: https://github.com/CoderLine/alphaTabSamplesWeb/tree/main/src/webpack-angular/src

Update to angular 19

results of ng build:
[error] ReferenceError: require is not defined at file:///home/xentropy/src/alphaTabSamplesWeb/src/webpack-angular/node_modules/@coderline/alphatab/dist/alphaTab.webpack.js:51:10 at ModuleJobSync.runSync (node:internal/modules/esm/module_job:399:35) at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:383:47) at loadESMFromCJS (node:internal/modules/cjs/loader:1565:24) at Module._compile (node:internal/modules/cjs/loader:1716:5) at Object..js (node:internal/modules/cjs/loader:1899:10) at Module.load (node:internal/modules/cjs/loader:1469:32) at Function._load (node:internal/modules/cjs/loader:1286:12) at TracingChannel.traceSync (node:diagnostics_channel:322:14) at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)

Link to jsFiddle, CodePen, Project

No response

Version and Environment

{
  "name": "alphatab-app",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "test": "ng test"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "^19.2.0",
    "@angular/compiler": "^19.2.0",
    "@angular/core": "^19.2.0",
    "@angular/forms": "^19.2.0",
    "@angular/platform-browser": "^19.2.0",
    "@angular/platform-browser-dynamic": "^19.2.0",
    "@angular/router": "^19.2.0",
    "@coderline/alphatab": "^1.4.3",
    "rxjs": "~7.8.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.15.0"
  },
  "devDependencies": {
    "@angular-builders/custom-webpack": "^19.0.1",
    "@angular-devkit/build-angular": "^19.2.9",
    "@angular/cli": "^19.2.9",
    "@angular/compiler-cli": "^19.2.0",
    "@types/jasmine": "~5.1.0",
    "jasmine-core": "~5.6.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.2.0",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.1.0",
    "typescript": "~5.7.2"
  }
}

Platform

Web

Anything else?

No response

@xentropy-git
Copy link
Author

xentropy-git commented Apr 26, 2025

Disregard. I was able to get it to work by cloning the repo fresh, and then using ng update to update to 18 first, then 19.

ng update @angular/core@18 @angular/cli@18 @angular-builders/custom-webpack@18
ng update @angular/core@19 @angular/cli@19 @angular-builders/custom-webpack@19

@Danielku15 Danielku15 added state-accepted This is a valid topic to work on. platform-javascript Related to the JavaScript version of alphaTab area-core Related to some core parts of alphaTab area-bundlers Related to the bundler plugins like webpack and vite and removed state-needs-triage Bug not triaged yet. labels Apr 27, 2025
@Danielku15
Copy link
Member

The problem goes a bit deper with how Node decides what files are loaded vs. how they are loaded when importing/requiring things. As I think its a broken behavior in Node I reported it here. With all these settings and features they have, I think this combination we use triggers stuff they haven't expected like this.

I also added some details in #2047 if you're interested.

Can you give v1.4.4 a try? It should mitigate the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-bundlers Related to the bundler plugins like webpack and vite area-core Related to some core parts of alphaTab platform-javascript Related to the JavaScript version of alphaTab state-accepted This is a valid topic to work on.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants