Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS map file 'sources' incorrect for dist/esm files #303

Open
4 tasks done
anthwinter opened this issue Nov 30, 2018 · 30 comments · May be fixed by #634 or #637
Open
4 tasks done

JS map file 'sources' incorrect for dist/esm files #303

anthwinter opened this issue Nov 30, 2018 · 30 comments · May be fixed by #634 or #637

Comments

@anthwinter
Copy link

Reporting an issue

Thank you for taking an interest in rrule! Please include the following in
your report:

  • Verify that you've looked through existing issues for duplicates before
    creating a new one

  • [] Code sample reproducing the issue. Be sure to include all input values you
    are using such as the exact RRule string and dates.
    N/a

  • [] Expected output
    N/a

  • [] Actual output
    N/a

  • The version of rrule you are using
    2.5.6

  • Your operating system
    macOs High Sierra 10.13.6

  • Your local timezone (run $ date from the command line
    of the machine showing the bug)
    Fri 30 Nov 2018 09:04:16 GMT

I am using Webpack v4 to bundle my vendor dependencies, I'm also using the Source Map Loader to extract source maps from my vendor files into one, this includes the rrule package.

I am getting warnings for each rrule 'esm' file stating it cannot find the source map, as it is trying to find it in the src directory, not the 'dist' directory.

WARNING in ./node_modules/rrule/dist/esm/weekday.js
Module Warning (from ./node_modules/source-map-loader/index.js):
(Emitted value instead of an instance of Error) Cannot find source file '../../src/weekday.ts': Error: Can't resolve '../../src/weekday.ts' in '/Users/anth/sites/mysite/node_modules/rrule/dist/esm'

If you look at one of the *.map files within the dist/esm folder of rrule, you will see that the sources point to the src directory, and this is what is causing the warnings when using the source-map-loader to try and extract all vendor mappings.

@davidgoli
Copy link
Collaborator

davidgoli commented Dec 4, 2018

@AnthW Thanks for the bug report! Would you be able to contribute a minimal repro test case, including a webpack.config.js with the appropriate project configuration? I'm the only active maintainer right now and it would greatly help with fixing the issue. Thanks!

@anthwinter
Copy link
Author

@davidgoli Sure. I have made https://github.com/anthw/rrule-map-issue

Just run yarn to get everything installed and then npx webpack should show the errors

@anthwinter
Copy link
Author

@davidgoli I have done a bit of research and I think the solution might be to add "sourceRoot": "./dist/esm" to the tsconfig.json file. I can create a PR to get this change submitted if you like? Is there anything else you would need if I do the PR?

anthwinter pushed a commit to anthwinter/rrule that referenced this issue Dec 10, 2018
This will ensure .map file sources are set to the dist folder, rather than the src folder. Fixes jkbrzt#303
@davidgoli
Copy link
Collaborator

Published v2.6.0.

@MaximKudriavtsev
Copy link

Hi @davidgoli,

I am using the rrule 2.6.0 and have the same issue.

image

In the console of the following example you can see a next warning

DevTools failed to parse SourceMap: https://zr81yovxml.codesandbox.io/node_modules/rrule/dist/es5/rrule.js.map

@anthwinter
Copy link
Author

I think I must have test wrong when I thought it was working as I still get the issue as reported too. Sorry!

@MaximKudriavtsev
Copy link

@davidgoli any news?

@joshkostal
Copy link

joshkostal commented Dec 2, 2019

@anthwinter This is an issue for me again, can it be reopened?

@anthwinter
Copy link
Author

@joshkostal I originally created a PR #305 to fix this, which was succeeded by #310, so #305 was closed without action.

I thought #310 fixed the issue but hadn't. So maybe #305 could be looked at again @davidgoli ?

My temporary work around for this was to exclude rrule within the loader. Not great, but stops the mass of warnings.

exclude: [path.resolve(__dirname, 'node_modules/rrule')]

@PatrickMcLennan
Copy link

Would also love to see or help with a resolution to this. I'm currently suppressing the warnings on my webpack-dev-server using @anthwinter 's solution but would rather not have to do so if that's possible.

Seeing the same warnings as above, using rrule 2.6.4 with webpack 4.44.5 + webpack-dev-server 3.10.2

@AryamnovEugeniy
Copy link

I'm seeing the same warnings with rrule 2.6.6. I would also like if this issue was resolved.

carestra pushed a commit to carestra/jhipster-devextreme-react that referenced this issue Jan 23, 2021
jkbrzt added a commit that referenced this issue Feb 21, 2021
Fix incorrect source paths in generated source maps (#303)
@bertho-zero
Copy link

bertho-zero commented Apr 21, 2021

A release would be welcome.

@RiodeJaneiroo
Copy link

RiodeJaneiroo commented Dec 15, 2021

i have the same issue with Create React App v5 (webpack v5)

"rrule": "^2.6.8",
"react-scripts": "5.0.0",

WARNING in ./node_modules/rrule/dist/esm/src/weekday.js Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): Failed to parse source map from '/Users/rio/Work/edr/node_modules/rrule/src/weekday.ts' file: Error: ENOENT: no such file or directory, open '/Users/rio/Work/edr/node_modules/rrule/src/weekday.ts' @ ./node_modules/rrule/dist/esm/src/index.js 20:0-36 20:0-36 @ ./src/service/schedulesService.js 18:12-27

@chunkily
Copy link

Having the same issue as @RiodeJaneiroo when I tried to update a react app that uses this library to create-react-app v5.0.0.

The source-map-loader module is printing the warnings because it is not able to find the source typescript files in the node_modules folder, which shouldn't be there because only the dist files are downloaded when we do an install.

I'm not sure how this issue can be resolved save for including the typescript source files in an install or removing sourcemaps in the generated dist.

For the time being I am working around this by pointing my rrule dependency on a forked branch that disables sourcemaps.

@edandersen
Copy link

This needs reopening as its still an issue with react-scripts 5.0.0 and rrule 2.6.8.

@chunkily is this forked branch you mentioned public?

@keyvanm
Copy link

keyvanm commented Mar 1, 2022

I'm having the same issue in create-react-app. Perhaps using inline source maps in the library would mitigate this issue? I had a similar problem while building a library recently, and inline sourcemaps resolved it.

In tsconfig.json under compilerOptions

{
  "compilerOptions": {
    ...
    "sourceMap": true,
    "inlineSources": true,
  },
  ...
}

@Kaishley
Copy link

Same issue here with

"rrule": "^2.6.8",
"react-scripts": "5.0.0",

@chunkily
Copy link

This needs reopening as its still an issue with react-scripts 5.0.0 and rrule 2.6.8.

@chunkily is this forked branch you mentioned public?

It is indeed public. https://github.com/chunkily/rrule/tree/sourcemapless

So here are the steps I took

  1. Fork the rrule repository

  2. Create a new branch that disables sourcemap generation

  3. Build the rrule library, and push the entire built dist/ folder to github

  4. Update the dependencies in the react app's package.json to use the fork

    "rrule": "chunkily/rrule#259ae356a78ae0d31a02eb4e87b3219072860abe"

@davidgoli
Copy link
Collaborator

Can someone please verify whether this still reproduces with v2.6.9? Thanks!

@jkronborg
Copy link
Contributor

@davidgoli Unfortunately my supposed fix included in version 2.6.9 did in fact not fix this issue. My bad.

@Kaishley
Copy link

Any idea how to get it fixed?

@chunkily
Copy link

Well, I can think of a three possible solutions, but each of them has their own cons.

  1. Disable sourcemaps. This might make it harder to debug any issues in production environments.
  2. Inline sourcemaps. This will bloat the size of the JS output.
  3. Include the typescript source files when doing an install. This will bloat the size of installs.

@Kaishley
Copy link

Kaishley commented Mar 24, 2022

I think the easiest solution is to include the src (.ts files) folder when installing.

image

stack overflow discussion

@Moinax
Copy link

Moinax commented May 10, 2022

Isn't this fixed yet, it's been there for a month already and block us to release our application with react-scripts 5.x

@louwers
Copy link

louwers commented Jul 12, 2022

Can this be re-opened?

@davidgoli davidgoli reopened this Jul 12, 2022
@LamOort
Copy link

LamOort commented Jul 24, 2022

I'm still having this issue after upgrading react-scripts to 5.0.0.

@aminsaedi
Copy link

Any updates?

@amadeogallardo
Copy link

This error still seems to be present on v2.7.1.

@mertcandonmez
Copy link

I'am having the same issue. Any updates?
"rrule": "2.7.1" > also tried with "rrule": "2.7.2"
"react-scripts": "5.0.1"

@dargmuesli
Copy link

dargmuesli commented Sep 4, 2024

This should be resolves by PR #634.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.