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

Error running tests #2273

Closed
Diaaz opened this issue Feb 15, 2024 · 4 comments · Fixed by #2308
Closed

Error running tests #2273

Diaaz opened this issue Feb 15, 2024 · 4 comments · Fixed by #2308
Assignees

Comments

@Diaaz
Copy link

Diaaz commented Feb 15, 2024

In version 2.42.0, when running tests in our project (npm run t) an error occurs:

./node_modules/copc/lib/utils/getter.js:78:65-78 - Error: Module not found: Error: Can't resolve 'fs' in 'Angular\node_modules\copc\lib\utils'

copc is a package reference in itowns package.json. Copc has a file getter.ts (https://github.com/connormanning/copc.js/blob/master/src/utils/getter.ts) which references 'fs'. This package was removed by npm because it contained malicious code: https://www.npmjs.com/package/fs?activeTab=versions

@Desplandis
Copy link
Contributor

@Diaaz fs is a module of the node.js standard library and thus not available in a browser context. It is lazy-loaded by the copc.js if we are in a node.js environnement which is not the case for iTowns. However it seems that webpack is not smart enough to eliminate this unused code leading to this error...
A temporary fix for this issue is available in our webpack.config.js:

// Prevent the generation of module fs for import on copc dependency

I will try to push a fix upstream to resolve this issue.

@Desplandis Desplandis self-assigned this Mar 6, 2024
@Desplandis
Copy link
Contributor

I pushed a fix upstream (see connormanning/copc.js#7), waiting for review. =)

@Diaaz
Copy link
Author

Diaaz commented Mar 25, 2024

Thanks for that! I see it was merged :)

@Diaaz
Copy link
Author

Diaaz commented Apr 4, 2024

Thanks, everything works in version 2.43.0.

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

Successfully merging a pull request may close this issue.

2 participants