-
Notifications
You must be signed in to change notification settings - Fork 25
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
Import Error #23
Comments
I have been able to get this to work, this guy has the same issue, he describes it probably a little better: also, this statement from another read may help
My Solution (so far) is to install the package, then Class File:
Then in my main Script:
Hoping @dot-i could help with this Deploying to a container in a K8's Prod wil be a little complex .. but probably just a manner of figuring out pathing |
I have the same problem. |
The problem is that this package is being built as a CommonJS module, and when running typescript in esmodule mode it is just simply incompatible. There's a decent discussion of the issue here: microsoft/TypeScript#2719 What happens when you import the package is that the default export is exposed as the {
ResourceEventType: { Added: 'ADDED', Modified: 'MODIFIED', Deleted: 'DELETED' },
ResourceMetaImpl: [class ResourceMetaImpl],
default: [class Operator]
} So, what I ended up doing to import this package is: import opmod from '@dot-i/k8s-operator'
const { default: Operator, ResourceEventType } = opmod My {
"compilerOptions": {
"target": "ES2022",
"module": "ES2022",
"moduleResolution": "nodenext",
"esModuleInterop": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"incremental": true,
"outDir": "dist"
},
"include": [
"src/**/*"
]
} I'm not sure if there's anything the packager can do about this, but one thing I noticed is that |
Maybe I should consider not exporting the class as default but named: export abstract class Operator {
// ...
} I plan to switch to and support the new 1.0 of |
This used to work a couple of months ago ..
I have a file index.mjs contains
./modules/operator/tenantoperator.mjs
contains thisNode.js V16.18.0 (Same as I had earlier) is now giving this error
@dot-i/k8s-operator": "^1.3.5
installedAt first I thought I had a circular reference, but
dpdm
says I am goodAL that is changed is that I want form a
index.js
toindex.mjs
, Im happily importing other commonJS packagesI'm actually stumped at the moment .. Amny suggestions?
The text was updated successfully, but these errors were encountered: