timeago-react icon indicating copy to clipboard operation
timeago-react copied to clipboard

Failed to parse source map

Open luckyxhu opened this issue 3 years ago • 7 comments

Run yarn start or yarn build output below warning:

WARNING in ./node_modules/timeago-react/esm/timeago-react.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'node_modules/timeago-react/src/timeago-react.tsx' file: Error: ENOENT: no such file or directory, open 'node_modules/timeago-react/src/timeago-react.tsx'

WARNING in ./node_modules/timeago.js/esm/format.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'node_modules/timeago.js/src/format.ts' file: Error: ENOENT: no such file or directory, open 'node_modules/timeago.js/src/format.ts'
 @ ./node_modules/timeago.js/esm/index.js 10:0-34 10:0-34
 @ ./node_modules/timeago-react/esm/timeago-react.js 51:0-52 113:4-10 118:6-12 124:4-10 143:16-22

WARNING in ./node_modules/timeago.js/esm/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'node_modules/timeago.js/src/index.ts' file: Error: ENOENT: no such file or directory, open 'node_modules/timeago.js/src/index.ts'
 @ ./node_modules/timeago-react/esm/timeago-react.js 51:0-52 113:4-10 118:6-12 124:4-10 143:16-22

WARNING in ./node_modules/timeago.js/esm/lang/en_US.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'node_modules/timeago.js/src/lang/en_US.ts' file: Error: ENOENT: no such file or directory, open 'node_modules/timeago.js/src/lang/en_US.ts'
 @ ./node_modules/timeago.js/esm/index.js 5:0-33 8:18-23
 @ ./node_modules/timeago-react/esm/timeago-react.js 51:0-52 113:4-10 118:6-12 124:4-10 143:16-22

WARNING in ./node_modules/timeago.js/esm/lang/zh_CN.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'node_modules/timeago.js/src/lang/zh_CN.ts' file: Error: ENOENT: no such file or directory, open 'node_modules/timeago.js/src/lang/zh_CN.ts'
 @ ./node_modules/timeago.js/esm/index.js 6:0-33 9:18-23
 @ ./node_modules/timeago-react/esm/timeago-react.js 51:0-52 113:4-10 118:6-12 124:4-10 143:16-22

WARNING in ./node_modules/timeago.js/esm/realtime.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'node_modules/timeago.js/src/realtime.ts' file: Error: ENOENT: no such file or directory, open 'node_modules/timeago.js/src/realtime.ts'
 @ ./node_modules/timeago.js/esm/index.js 11:0-44 11:0-44 11:0-44
 @ ./node_modules/timeago-react/esm/timeago-react.js 51:0-52 113:4-10 118:6-12 124:4-10 143:16-22

WARNING in ./node_modules/timeago.js/esm/register.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'node_modules/timeago.js/src/register.ts' file: Error: ENOENT: no such file or directory, open 'node_modules/timeago.js/src/register.ts'
 @ ./node_modules/timeago.js/esm/index.js 7:0-38 8:0-8 9:0-8 12:0-20
 @ ./node_modules/timeago-react/esm/timeago-react.js 51:0-52 113:4-10 118:6-12 124:4-10 143:16-22

WARNING in ./node_modules/timeago.js/esm/utils/date.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'node_modules/timeago.js/src/utils/date.ts' file: Error: ENOENT: no such file or directory, open 'node_modules/timeago.js/src/utils/date.ts'
 @ ./node_modules/timeago.js/esm/format.js 1:0-51 12:12-19 14:9-19
 @ ./node_modules/timeago.js/esm/index.js 10:0-34 10:0-34
 @ ./node_modules/timeago-react/esm/timeago-react.js 51:0-52 113:4-10 118:6-12 124:4-10 143:16-22

WARNING in ./node_modules/timeago.js/esm/utils/dom.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'node_modules/timeago.js/src/utils/dom.ts' file: Error: ENOENT: no such file or directory, open 'node_modules/timeago.js/src/utils/dom.ts'
 @ ./node_modules/timeago.js/esm/realtime.js 1:0-71 19:8-18 31:2-12 41:18-28 57:14-30
 @ ./node_modules/timeago.js/esm/index.js 11:0-44 11:0-44 11:0-44
 @ ./node_modules/timeago-react/esm/timeago-react.js 51:0-52 113:4-10 118:6-12 124:4-10 143:16-22

Environment

webpack 5.65.0 source-map-loader 3.0.0 node v16.13.1

luckyxhu avatar Dec 21 '21 18:12 luckyxhu

I think this is an issue of source-map-loader rather than time-ago, you could just try to ignore this warning referring to this doc.

alanwei0 avatar Dec 30 '21 14:12 alanwei0

See: https://github.com/facebook/create-react-app/issues/11924#issuecomment-1016947373

The problem is that the library's source files are being referenced but not being published, just the compiled code in the dist directory. I'm also having this issue with zod, there's an open issue about it and a PR to publish the source files which would fix the problem.

ErwinSteffens avatar Jan 20 '22 14:01 ErwinSteffens

@hustcc I would re-open this. I think you need to publish the source, otherwise it's impossible for the source maps to be applied, and any debugging that hits source in this module will be very difficult to follow.

garfieldnate avatar Feb 18 '23 19:02 garfieldnate

Also, note that this fix needs to be applied in the timeago package, as well.

garfieldnate avatar Feb 18 '23 19:02 garfieldnate

any solutions?

Srivallabh13 avatar Aug 25 '23 11:08 Srivallabh13

Solution add .env GENERATE_SOURCEMAP=false

moises2406 avatar Jan 24 '24 13:01 moises2406

Solution add .env GENERATE_SOURCEMAP=false

Not worked for me. And i don't think this is an elegant solution

selankon avatar Feb 21 '24 13:02 selankon