-
Notifications
You must be signed in to change notification settings - Fork 7
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
abort-controller dependency problem #122
Comments
@David-B-A Hi David! So the issue comes from node's (semi) recent ESM resolution deciding to require full specifiers. In short, node would you like you to write this: import { foo } from 'bar.mjs'; rather than this: import { foo } from 'bar'; When using native ESM. Because of this, the Webpack team has decided to also add that requirement. Unfortunately, we don't always have control over code, as is the case for dependencies! The To remedy this, I can try updating our code to manually handle the polyfilling, importing According to this comment, I would recommend trying to add the following to your webpack config: {
test: /\.m?js$/,
resolve: {
fullySpecified: false
}
} Since you're using CRA, it can be a bit tough to change your webpack config. Personally, I prefer CRACO which doesn't (officially) support CRA 5 yet, but there is a pretty solid beta version that you can use! What that looks like is to follow their instructions, but use Then, in your module.exports = function ({ env }) {
return {
webpack: {
module: { rules: [{ test: /\.m?js$/, resolve: { fullySpecified: false } }] },
},
};
} I hope this helps, and I'm terribly sorry that you've run into this mess! As you go through this, I'm going to perform some experiments myself using this library with a fresh CRA 5 webapp and try to ease this burden/write better documentation addressing this specific situation! |
Hi @TaylorBeeston, Than you very much for your answer. I tried with CRACO, but still had the same error, I think it could be due to the incompatibility with create-react-app 5. Finally I decided to setup the project with webpack and babel: "devDependencies": { These are my webpack rules:
And it is working well now, so thank you very much for your help. Only got these two warnings while compiling (I address them if could be useful): ` [webpack-dev-server] WARNING in ./node_modules/@learncard/core/dist/core.esm.js 32:11-18 |
@David-B-A Awesome! Glad you got it working! I'm going to try and get a minimal example using CRA 5 up if I can. It should definitely be possible to use |
Hello Everyone,
I am getting started with LearnCard SDK, I just installed it using pnpm (pnpm install @learncard/core), but when trying to import { initLearnCard } from '@learncard/core', a dependency error appears:
logger.ts:268 Uncaught Error: Cannot find module './dist/abort-controller'
at webpackMissingModule (logger.ts:268:1)
at ./node_modules/.pnpm/[email protected]/node_modules/abort-controller/polyfill.mjs (logger.ts:268:1)
at options.factory (react refresh:6:1)
at webpack_require (bootstrap:24:1)
at fn (hot module replacement:62:1)
at ./node_modules/.pnpm/@[email protected]/node_modules/@learncard/core/dist/core.esm.js (index.js:91:1)
at options.factory (react refresh:6:1)
at webpack_require (bootstrap:24:1)
at fn (hot module replacement:62:1)
at ./src/pages/Credentials/IssueCredential/index.jsx (index.jsx:33:1)
This issue could not be associated with learn-card but its dependency abort-controller (.mjs or .js). Reviewing abort-controller on npm it appears to not being updated 4 years ago.
App info:
npm -v: 8.19.2
node -v: 16.17.0
React app created with create-react-app, with the following dependencies:
When installing via pnpm, following version of learncard is added:
"@learncard/core": "^7.0.1",
I would appreciate if you could help me to kow how to solve this problem, or if I have made a mistake on any step or there is any missing or incompatible dependency. Thank you!
The text was updated successfully, but these errors were encountered: