orb icon indicating copy to clipboard operation
orb copied to clipboard

When installed in my app and run build I got warnings

Open stefanak-michal opened this issue 2 years ago • 6 comments

I have reactjs app with this project. When I run "react-scripts build" I get a lot of these errors:

Failed to parse source map from 'C:\Projects\cyphergui\node_modules\@memgraph\orb\src\common\color.ts' file: Error: ENOENT: no such file or directory, open 'C:\Projects\cyphergui\no
de_modules\@memgraph\orb\src\common\color.ts'

Failed to parse source map from 'C:\Projects\cyphergui\node_modules\@memgraph\orb\src\common\distance.ts' file: Error: ENOENT: no such file or directory, open 'C:\Projects\cyphergui
\node_modules\@memgraph\orb\src\common\distance.ts'

I don't understand why it tries to reach "src" directory while in my node_modules it contains only "dist". I've added the package with "npm install @memgraph/orb".

image

It is not problem when I run it locally where it takes it as warnings and build is finished and works. But when I run it in CI it acts like errors and it crash.

What I can do about it?

stefanak-michal avatar Jan 21 '23 10:01 stefanak-michal

I'm not too familiar with react-scripts, but it's really strange that it works locally and not during CI. I'll try setting up a similar environment. In the meantime you can maybe try disabling sourcemaps in your .env? Or running something like GENERATE_SOURCEMAP=false react-scripts build instead.

cizl avatar Jan 24 '23 15:01 cizl

When you run in CI it sets environment variable called CI. With this variable it takes warnings as errors. I disabled it temporally with setting CI env var to empty value.

stefanak-michal avatar Jan 24 '23 16:01 stefanak-michal

Oh, I get it. So you managed to make it work for now by ignoring the warnings. Not ideal, I'll definitely investigate the issue but can't promise anything for the immediate future. Thanks for reporting it! If you have a project setup repo that you can share that would be very helpful. :smile:

cizl avatar Jan 25 '23 09:01 cizl

I hit this problem with https://github.com/stefanak-michal/cyphergui/

When you want to test it locally you have to set env variable CI=true and execute npm run build

stefanak-michal avatar Jan 25 '23 09:01 stefanak-michal

Thanks a lot!

cizl avatar Jan 25 '23 12:01 cizl

I believe this issue stems from the fact that the source maps in the distribution reference the ts files which are not included in the npm package: /dist/orb.js.map:

{"version":3,"file":"orb.js","sourceRoot":"","sources":["../src/orb.ts"],...

There are 2 options to fix this,

  1. Remove source-map from the webpack configuration when bundling the non-development package
  2. Include the src folder in the npm distribution

eacaps avatar Aug 11 '23 18:08 eacaps