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

AOT=1 meteor broken for Angular versions ≥ 13 #1988

Open
domq opened this issue May 3, 2023 · 3 comments
Open

AOT=1 meteor broken for Angular versions ≥ 13 #1988

domq opened this issue May 3, 2023 · 3 comments

Comments

@domq
Copy link

domq commented May 3, 2023

Steps to reproduce:

  1. git clone [email protected]:domq/angular-meteor-base.git
  2. cd angular-meteor-base; meteor npm i
  3. env AOT=1 meteorbehavior OK, see below
  4. git checkout upgrade/angular-12 && env AOT=1 meteorbehavior OK
  5. git checkout upgrade/angular-13 && env AOT=1 meteorfailure, see below

where

  • “behavior OK” means that when AOT=1, the server starts up without complaining, and the browser's developer tools show that no HTML downloads occur.
  • “failure” means
    @angular/compiler and @angular/compiler-cli must be installed for AOT compilation!
    AOT compilation disabled!
    Ignore this if you are using AngularJS 1.X
    
@domq
Copy link
Author

domq commented May 3, 2023

By applying #1987, it becomes clear that the issue is that Meteor is unable to load the @angular/compiler module:

Error: Cannot find module '/Users/quatrava/Dev/angular-meteor-base/node_modules/@angular/compiler'
Require stack: - /Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/isobuild/bundler.js - /Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/isobuild/compiler.js - /Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/packaging/package-client.js - /Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/packaging/catalog/catalog-remote.js - /Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/packaging/catalog/catalog.js - /Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/packaging/tropohouse.js - /Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/meteor-services/config.js - /Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/meteor-services/auth.js - /Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/utils/http-helpers.js - /Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/packaging/warehouse.js - /Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/cli/main.js - /Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/index.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:931:15) at Function.Module._load (internal/modules/cjs/loader.js:774:27) at Module.require (internal/modules/cjs/loader.js:1003:19) at require (internal/modules/cjs/helpers.js:107:18) at Object.require (/tools/isobuild/bundler.js:2196:22) at makeInstallerOptions.fallback (packages/modules-runtime.js:712:18) at Module.require (packages/modules-runtime.js:244:14) at require (packages/modules-runtime.js:258:21) at module (packages/Angular Compilers/plugin/register.js:26:16) at fileEvaluate (packages/modules-runtime.js:336:7) at Module.require (packages/modules-runtime.js:238:14) at require (packages/modules-runtime.js:258:21) at :84:1 at :89:3 at __bottom_mark__ (/Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/utils/tools/utils/parse-stack.ts:92:14) at /Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/fs/tools/fs/files.ts:1160:7 at Function.time (/Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/tool-env/tools/tool-env/profile.ts:284:30) at Object.runJavaScript (/Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/fs/tools/fs/files.ts:1037:18) at /tools/isobuild/bundler.js:2254:15 at Function.each (/Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore-node-f-pre.js:1316:7) at JsImage.load (/tools/isobuild/bundler.js:2114:7) at /tools/isobuild/isopack.js:476:16 at Object.enterJob (/tools/utils/buildmessage.js:388:12) at /tools/isobuild/isopack.js:466:20 at Function.each (/Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore-node-f-pre.js:1321:7) at Isopack.ensurePluginsInitialized (/tools/isobuild/isopack.js:454:7) at /tools/isobuild/compiler.js:381:16 at Array.forEach () at /tools/isobuild/compiler.js:380:26 at Object.enterJob (/tools/utils/buildmessage.js:388:12) at /tools/isobuild/compiler.js:376:16 at /tools/isobuild/compiler.js:186:28 at Slot.withValue (/Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/@wry/context/lib/context.esm.js:69:29) at Object.withCache (/Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/fs/tools/fs/files.ts:1543:39) at /tools/isobuild/compiler.js:185:11 at Function.each (/Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore-node-f-pre.js:1316:7) at Object.compile (/tools/isobuild/compiler.js:180:5) at /tools/isobuild/isopack-cache.js:353:30 at Object.enterJob (/tools/utils/buildmessage.js:388:12) at IsopackCache._loadLocalPackage (/tools/isobuild/isopack-cache.js:308:18) at /tools/isobuild/isopack-cache.js:242:16 at Function.time (/Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/tool-env/tools/tool-env/profile.ts:284:30) at /tools/isobuild/isopack-cache.js:241:17 at Object.enterJob (/tools/utils/buildmessage.js:388:12) at IsopackCache._ensurePackageLoaded (/tools/isobuild/isopack-cache.js:232:20) at /tools/isobuild/isopack-cache.js:74:14 at /tools/packaging/package-map.js:57:7 at Function.each (/Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore-node-f-pre.js:1321:7) at exports.PackageMap.eachPackage (/tools/packaging/package-map.js:49:7) at IsopackCache.buildLocalPackages (/tools/isobuild/isopack-cache.js:73:24) at /tools/project-context.js:961:25 at Object.enterJob (/tools/utils/buildmessage.js:388:12) at ProjectContext._buildLocalPackages (/tools/project-context.js:960:18) at /tools/project-context.js:365:35 at Object.enterJob (/tools/utils/buildmessage.js:388:12) at ProjectContext._completeStagesThrough (/tools/project-context.js:355:18) at /tools/project-context.js:347:12 at Function.run (/Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/tool-env/tools/tool-env/profile.ts:289:14) at ProjectContext.prepareProjectForBuild (/tools/project-context.js:346:13) at /tools/cli/commands-packages.js:2290:20 at Object.capture (/tools/utils/buildmessage.js:283:5) at Command.func (/tools/cli/commands-packages.js:2289:27) at /tools/cli/main.js:1534:15 { code: 'MODULE_NOT_FOUND', requireStack: [ '/Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/isobuild/bundler.js', '/Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/isobuild/compiler.js', '/Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/packaging/package-client.js', '/Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/packaging/catalog/catalog-remote.js', '/Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/packaging/catalog/catalog.js', '/Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/packaging/tropohouse.js', '/Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/meteor-services/config.js', '/Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/meteor-services/auth.js', '/Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/utils/http-helpers.js', '/Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/packaging/warehouse.js', '/Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/cli/main.js', '/Users/quatrava/.meteor/packages/meteor-tool/.2.11.0.1px97s8.nn7t++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/index.js' ] } @angular/compiler and @angular/compiler-cli must be installed for AOT compilation! AOT compilation disabled! Ignore this if you are using AngularJS 1.X

@domq
Copy link
Author

domq commented May 4, 2023

The error is caused by some kind of ES Module mishap in version 13:

$ rm node_modules; ln -s node_modules-v13 node_modules
$ meteor node -e 'require("@angular/compiler")'
internal/modules/cjs/loader.js:977
    throw new ERR_REQUIRE_ESM(filename);
    ^

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /Users/quatrava/Dev/angular-meteor-base/node_modules-v13/@angular/compiler/fesm2015/compiler.mjs
    at new NodeError (internal/errors.js:322:7)
    at Module.load (internal/modules/cjs/loader.js:977:11)
    at Function.Module._load (internal/modules/cjs/loader.js:819:12)
    at Module.require (internal/modules/cjs/loader.js:1003:19)
    at require (internal/modules/cjs/helpers.js:107:18)
    at [eval]:1:1
    at Script.runInThisContext (vm.js:134:12)
    at Object.runInThisContext (vm.js:310:38)
    at internal/process/execution.js:81:19
    at [eval]-wrapper:6:22 {
  code: 'ERR_REQUIRE_ESM'
}
$ rm node_modules; ln -s node_modules-v12 node_modules
$ meteor node -e 'require("@angular/compiler")'
$ rm node_modules; ln -s node_modules-v13 node_modules
$ meteor node -e 'require("@angular/compiler")'
internal/modules/cjs/loader.js:977
    throw new ERR_REQUIRE_ESM(filename);
    ^

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /Users/quatrava/Dev/angular-meteor-base/node_modules-v13/@angular/compiler/fesm2015/compiler.mjs
    at new NodeError (internal/errors.js:322:7)
    at Module.load (internal/modules/cjs/loader.js:977:11)
    at Function.Module._load (internal/modules/cjs/loader.js:819:12)
    at Module.require (internal/modules/cjs/loader.js:1003:19)
    at require (internal/modules/cjs/helpers.js:107:18)
    at [eval]:1:1
    at Script.runInThisContext (vm.js:134:12)
    at Object.runInThisContext (vm.js:310:38)
    at internal/process/execution.js:81:19
    at [eval]-wrapper:6:22 {
  code: 'ERR_REQUIRE_ESM'
}
$ rm node_modules; ln -s node_modules-v12 node_modules
$ meteor node -e 'require("@angular/compiler")'
$

@domq
Copy link
Author

domq commented May 4, 2023

I pinned this down to the fact that Angular v13's @angular/compiler started putting an exports field in its (generated) package.json, which Meteor doesn't support.

I'm having trouble digging down any further, precisely because the package.json in @angular/compiler releases appears to be generated by a combination of things called “Bazel“, “bazelisk”, “Ivy” and more.

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

No branches or pull requests

1 participant