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

devMode in compileUiExtension throws error on next version #1794

Closed
HarunKilic opened this issue Sep 21, 2022 · 5 comments
Closed

devMode in compileUiExtension throws error on next version #1794

HarunKilic opened this issue Sep 21, 2022 · 5 comments
Assignees
Labels
type: bug 🐛 Something isn't working
Milestone

Comments

@HarunKilic
Copy link
Contributor

HarunKilic commented Sep 21, 2022

Describe the bug
When enabling devMode in compileUiExtension, it will throw an error saying: unknown argument --base-path
image

Environment (please complete the following information):

  • @vendure/core version: 2.0.0-next.17
  • Nodejs version: 16.17.0
  • Angular version: 13.2.3

Additional context
The issue might be because the option is deprecated and should be set in angular.json instead:
https://stackoverflow.com/questions/71604562/unknown-option-base-href-angular-13-ng-serve

@HarunKilic HarunKilic added the type: bug 🐛 Something isn't working label Sep 21, 2022
@HarunKilic
Copy link
Contributor Author

I've managed to get the ui part working by:

  • Removing --base-path=${basePath} from \node_modules\@vendure\ui-devkit\compiler\compile.js as its deprecated now.
  • Changed "baseHref": "/", in \admin-ui\angular.json to "baseHref": "/admin/",

The app will now run successfully on port 4200.
BUT, it will also try to query on port 4200, which should be on port 3000, where Vendure actually runs.

@michaelbromley
Copy link
Member

Pasting from Slack conversation to make it public:


Thanks for taking the time to try to solve this. In general, running on port 4200 doesn't work due to the way that the Admin UI is trying to infer the api url. It defaults to auto which just uses the browser url to guess. You should be able to explicitly set

AdminUiPlugin.init({ 
  //..
  adminUiConfig: {
    apiHost: 'http://localhost/'
    apiPort: '3000'
  } 
}),

@HarunKilic
Copy link
Contributor Author

HarunKilic commented Sep 23, 2022

Just to sum up for a temporary solution:

  1. Remove --base-href=${baseHref} from \node_modules\@vendure\ui-devkit\compiler\compile.js on line 99
  2. Change "baseHref": "/", in \admin-ui\angular.json to "baseHref": "/admin/" (you will have to run the app with compileUiExtensions atleast once without devMode so that the folder can be generated.)
  3. Add
AdminUiPlugin.init({ 
  //..
  adminUiConfig: {
   //..
    apiPort: 3000
  } 
}),

@HarunKilic
Copy link
Contributor Author

HarunKilic commented Sep 23, 2022

To make this a permanent solution, the --base-href in the cli should be added to angular.json with dynamic values somehow.

@martijnvdbrug
Copy link
Collaborator

Same problem. Not sure if still needed, but these are the dependencies installed in my project after removing yarn.lock

yarn list --pattern @angular
yarn list v1.22.17
├─ @angular-devkit/architect@0.1302.6
│  └─ @angular-devkit/core@13.2.6
├─ @angular-devkit/build-angular@13.2.6
│  └─ @angular-devkit/core@13.2.6
├─ @angular-devkit/build-webpack@0.1302.6
├─ @angular-devkit/core@13.2.4
├─ @angular-devkit/schematics@13.2.4
├─ @angular/animations@13.2.3
├─ @angular/cdk@13.2.3
├─ @angular/cli@13.2.4
│  └─ @angular-devkit/architect@0.1302.4
├─ @angular/common@13.2.3
├─ @angular/compiler-cli@13.2.3
├─ @angular/compiler@13.2.3
├─ @angular/core@13.2.3
├─ @angular/forms@13.2.3
├─ @angular/language-service@13.2.3
├─ @angular/platform-browser-dynamic@13.2.3
├─ @angular/platform-browser@13.2.3
└─ @angular/router@13.2.3
yarn list --pattern @vendure
yarn list v1.22.17
├─ @vendure/admin-ui-plugin@2.0.0-next.27
├─ @vendure/admin-ui@2.0.0-next.27
├─ @vendure/common@2.0.0-next.27
├─ @vendure/core@2.0.0-next.27
├─ @vendure/testing@2.0.0-next.27
└─ @vendure/ui-devkit@2.0.0-next.27

@michaelbromley michaelbromley moved this from 📅 Planned to 📋 Backlog in Vendure OS Roadmap Apr 18, 2023
@michaelbromley michaelbromley moved this from 📋 Backlog to 🏗 In progress in Vendure OS Roadmap Apr 21, 2023
@michaelbromley michaelbromley moved this from 🏗 In progress to ✅ Done in Vendure OS Roadmap Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 🐛 Something isn't working
Projects
Archived in project
Development

No branches or pull requests

3 participants