itowns
itowns copied to clipboard
Error running tests
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
@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
: https://github.com/iTowns/itowns/blob/4f361c34a38be0dbad754ac2ce2940f894502f7c/webpack.config.js#L85
I will try to push a fix upstream to resolve this issue.
I pushed a fix upstream (see connormanning/copc.js#7), waiting for review. =)
Thanks for that! I see it was merged :)
Thanks, everything works in version 2.43.0.