-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Admin Ui: Angular error when compiling AdminUiPlugin #758
Comments
I ran into some issues with Angular after updating, and the solution in my case seemed to be to delete the lockfile, node_modules, and then reinstall. If you've not tried that yet, have a go and let me know if it solves it. |
This didn't change the outcome. Sadly I have no idea what could cause this issue. |
OK. Is there more to the stack trace you can share? |
Last year some people experienced the bug after an Angular upgrade from 8 to 9, there was something wrong with a decorator. But I compiled the admin-ui successfully after the upgrade to Angular 11 last week – no clue again. Chromium:
Firefox:
This is the error trace from the browser – is there a better one I could get you? Also, does it currently work on your system – then it should be an error on my end? |
Thanks, the non-minified stack trace is much more useful. I have a project with quite a lot of custom UI stuff being compiled. Didn't have any issue with the latest beta.3 (after deleting lockfile as mentioned). So take another look at your end, let me know if you find anything else useful. If not, then a minimal reproduction repo would be helpful for me to debug. |
Will do, thank you! |
I found this related issue: angular/angular#35282, |
I went though angular/angular#35282 and tried to re-create the error in the real-world-vendure repo:
Neither of those reproduced the error. So I'm a bit stuck in fixing this without a reproduction. One question I have is this: did you delete the |
I think I have a minimal reproduction. It does use
// dev-server.ts
import {createTestEnvironment, registerInitializer, SqljsInitializer, testConfig,} from '@vendure/testing';
import {DefaultLogger, LogLevel} from '@vendure/core';
import {AdminUiPlugin} from '@vendure/admin-ui-plugin';
import {compileUiExtensions} from '@vendure/ui-devkit/compiler';
import * as path from 'path';
import {initialData} from '../../test/initialData';
(async () => {
testConfig.logger = new DefaultLogger({level: LogLevel.Debug});
registerInitializer('sqljs', new SqljsInitializer('__data__'));
testConfig.plugins.push(AdminUiPlugin.init({
route: 'admin',
port: 3002,
app: compileUiExtensions({
outputPath: path.join(__dirname, '__admin-ui'),
extensions: [],
devMode: true,
}),
}));
testConfig.apiOptions.shopApiPlayground = {};
testConfig.apiOptions.adminApiPlayground = {};
const {server} = createTestEnvironment(testConfig);
await server.init({
initialData,
productsCsvPath: '../test/products-import.csv',
});
})(); Dependency versions: // yarn list --pattern "@angular/*"
yarn list v1.22.10
├─ @angular/animations@11.2.4
├─ @angular/cdk@11.2.3
├─ @angular/cli@11.2.4
├─ @angular/common@11.2.4
├─ @angular/compiler-cli@11.2.5
├─ @angular/compiler@11.2.5
├─ @angular/core@11.2.4
├─ @angular/forms@11.2.4
├─ @angular/language-service@11.2.4
├─ @angular/platform-browser-dynamic@11.2.4
├─ @angular/platform-browser@11.2.4
└─ @angular/router@11.2.4 ts-node yarn list v1.22.10
└─ ts-node@9.1.1 typescript
|
Great, thanks. Initially I could not reproduce the error. My angular deps looked like:
Then I deleted the lockfile and reinstalled, so my Angular deps were the same as your list. Now I get the error. The specific packages changed are:
So a work-around for now would be to use yarn resolutions to pin those 3 Angular packages to the previous version. |
OK I think I have the reason right here: angular/angular#41193 (comment)
So the The solution is that I need to pin the dependencies of the vendure/packages/ui-devkit/package.json Lines 39 to 41 in 7cc7222
|
Can confirm, with compiler 11.2.4 it works.
What's the long term solution for this? Thank you for investigating! |
I think it's not the compiler version itself, but the forced resolution. When I put compiler version 11.2.3 into the resolutions
it still works for me. Therefore I would say the solution is to have the same compiler version accross the projects. |
Relates to #758. Updated and pinned all Angular dependencies to match between admin-ui & ui-devkit.
Relates to #758. Prevents future updates to the Angular versions from introducing version mismatch errors
I've implemented an automated check to ensure that Angular compiler versions match between the admin-ui & ui-devkit packages. This should prevent such errors being re-introduced in future. |
If you're using yarn workspaces or Lerna with yarn, don't forget to add the |
Compiling the AdminUiPlugin works with devMode since 1.0.0-beta.3 again, but now the compiled admin-ui throws an error in the Angular code when opening the admin page in browser:
TypeError: e.factory is not a function
To Reproduce
AdminUiPlugin.init({ ... app: compileUiExtensions({ ... }) )
main.ts:16 TypeError: e.factory is not a function
– page doesn't loadEmpty
extensions: []
or parameters, including devMode, don't seem to make a difference.The text was updated successfully, but these errors were encountered: