orama icon indicating copy to clipboard operation
orama copied to clipboard

Failed to parse source maps while running react localhost server

Open pn-wiseverge opened this issue 2 years ago • 1 comments

Describe the bug When using react 18 with Typescript some source map warnings are show when running server locally.

To Reproduce Steps to reproduce the behavior:

  1. Go to Code Sandobox
  2. Fork Code Sandbox
  3. On Code Sandbox projects list, download the forked Sandbox as zip
  4. Unzip
  5. Run yarn install
  6. Run yarn start

Expected behavior Clean server console

Screenshots Example of logs that appear:

WARNING in ./node_modules/@lyrasearch/lyra/dist/esm/src/tokenizer/stop-words/ru.js
Module Warning (from ./node_modules/react-scripts/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '<--project-folder-->/node_modules/@lyrasearch/lyra/src/tokenizer/stop-words/ru.ts' file: Error: ENOENT: no such file or directory, open '<--project-folder-->/node_modules/@lyrasearch/lyra/src/tokenizer/stop-words/ru.ts'

WARNING in ./node_modules/@lyrasearch/lyra/dist/esm/src/tokenizer/stop-words/se.js
Module Warning (from ./node_modules/react-scripts/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '<--project-folder-->/node_modules/@lyrasearch/lyra/src/tokenizer/stop-words/se.ts' file: Error: ENOENT: no such file or directory, open '<--project-folder-->/node_modules/@lyrasearch/lyra/src/tokenizer/stop-words/se.ts'

WARNING in ./node_modules/@lyrasearch/lyra/dist/esm/src/utils.js
Module Warning (from ./node_modules/react-scripts/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '<--project-folder-->/node_modules/@lyrasearch/lyra/src/utils.ts' file: Error: ENOENT: no such file or directory, open '<--project-folder-->/node_modules/@lyrasearch/lyra/src/utils.ts'

WARNING in ./node_modules/@lyrasearch/lyra/dist/esm/stemmer/lib/en.js
Module Warning (from ./node_modules/react-scripts/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '<--project-folder-->/node_modules/@lyrasearch/lyra/stemmer/lib/en.js' file: Error: ENOENT: no such file or directory, open '<--project-folder-->/node_modules/@lyrasearch/lyra/stemmer/lib/en.js'

Desktop (please complete the following information):

  • OS: MacOS Ventura 13.0.1
  • Browser: Not applicable
  • Lyra Version: 0.2.8 (issue also confirmed on 0.3.0)
  • Node: v16.16.0
  • Yarn: 1.22.19

Additional context If I clone this project locally and, on lyra folder, run:

  • pnpm install
  • pnpm run build

and then on my projects folder run:

  • yarn install ../lyra (pointing to the cloned repo)

I get no warnings, probably because I locally have the files that the source-maps are trying to get.

It appears to be some misconfiguration with the source-maps during build, before deploy of lyra.

pn-wiseverge avatar Nov 15 '22 16:11 pn-wiseverge

Source code should be included along with transpiled code in order to have source maps working. Currently released npm package does not ship with it.

I see two options here:

  • Disabling source maps when shipping the package.
  • Including source code along with transpiled code and source maps.

The only (potential) drawback in keeping to include source maps as part of the compilation step is in term of performance since it takes compilation time. Probably that's not a problem right now, but I've no metric about that. From the consumer point of view it should have no impact since source maps does not get loaded unless the dev tool is open.

nebarf avatar Nov 17 '22 15:11 nebarf

I've just spoken with some Lyra's maintainers and decided to put this on hold for a moment until v.4.0.0 (with a refactored build system) is released.

toomuchdesign avatar Jan 04 '23 13:01 toomuchdesign