-
Notifications
You must be signed in to change notification settings - Fork 12
fix: correct checking for runtime version installed in the project and provide example API endpoint in code snippets #230
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
Conversation
✅ Deploy Preview for plugin-angular-universal-demo ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
…on in .netlify/plugins
…ible server.ts error
src/helpers/getPackageVersion.js
Outdated
const siteRequire = createRequire(root) | ||
packagePath = siteRequire.resolve('@netlify/angular-runtime/package.json') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In practice this was finding the @netlify/angular-runtime
installed in <project-dir>/.netlify/plugins/node_modules
despite paths
being just ['<project-dir'>]
(likely due require cache), but this should check user-installed version - this one with createRequire
seems to work in practice as intended (it was now tested with monkey patching plugin instance installed in .netlify/plugins
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noice!
019cf7d
@@ -31,7 +32,7 @@ module.exports.getAngularVersion = getAngularVersion | |||
const getAngularRuntimeVersion = async function (root) { | |||
let packagePath | |||
try { | |||
const siteRequire = createRequire(root) | |||
const siteRequire = createRequire(join(root, ':internal:')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the previous version ended up not working when actually installed and resulted in MODULE_NOT_FOUND (that was not immediate apparent, because we swallow the error message)
pathname
not assign it dohserver.ts
is found@netlify/angular-runtime
version (current one doesn't actually do anything, because it somehow is able to resolve plugin installed in<project-dir>/.netlify/plugins/node_modules
despite usingpaths
param - probably related torequire.cache
(?) )