koblas / stdnum-js

A JavaScript library to provide functions to handle, parse and validate standard numbers.
MIT License
39 stars 26 forks source link

Getting 'Failed to parse source map from ...' warnings on CRA 5.0.1 #39

Open ucanfil opened 1 year ago

ucanfil commented 1 year ago

Thanks for the great library!

This is not a breaking issue for me but I had to post this as an issue since there is no discussions tab in the repo. Using stdnum-js latest version with CRA v5.0.1 by importing import { stdnum } from 'stdnum'; and getting a bunch of warnings, for ex.:

WARNING in ./node_modules/stdnum/lib/esm/ro/cnp.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '.../node_modules/stdnum/src/ro/cnp.ts' file: Error: ENOENT: no such file or directory, open '/Users/buraktilek/projects/application-frontend/node_modules/stdnum/src/ro/cnp.ts'

Is this due to CRA or due to the library I wonder 🤔, much appreciated if you can provide some answer, cheers!

koblas commented 1 year ago

Thanks for the report. It'll be a little bit until I can dig into this in some detail but is very weird.

Can you provide your tsconfig.json file for reference since I'm assuming that that might be part of the source of the "error". Or if you have any other babel settings of note.

ucanfil commented 1 year ago

Hey @koblas, thanks for checking! Here is my tsconfig: (There is no custom babel config)

{
  "compilerOptions": {
    "target": "es6",
    "module": "esnext",
    "outDir": "build",
    "rootDir": "src",
    "strict": true,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "allowSyntheticDefaultImports": true,
    "useUnknownInCatchVariables": false,
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react",
  },
  "include": [
    "src"
  ],
  "exclude": [
    "node_modules"
  ]
}

This might be relevant -> https://github.com/facebook/create-react-app/pull/11752

**Also if you don't have time and this happens to be a fault on lib side I'd like to contribute if I can, thanks!