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

Published sourcemaps contain absolute paths in publisher's home directory #13883

Closed
jsnajdr opened this issue Feb 14, 2019 · 3 comments · Fixed by #14409
Closed

Published sourcemaps contain absolute paths in publisher's home directory #13883

jsnajdr opened this issue Feb 14, 2019 · 3 comments · Fixed by #14409
Labels
Needs Technical Feedback Needs testing from a developer perspective. npm Packages Related to npm packages [Type] Bug An existing feature does not function as intended [Type] Build Tooling Issues or PRs related to build tooling

Comments

@jsnajdr
Copy link
Member

jsnajdr commented Feb 14, 2019

  1. Install the @wordpress/api-fetch package into your project.
  2. Look at the node_modules/@wordpress/api-fetch/build/index.js.map file.

The sources field near the beginning contains an absolute path into Riads home directory:

/Users/riad/Workspace/a8c/gutenberg/packages/api-fetch/src/index.js

I discovered this when upgrading Calypso to Jest 24.1 in Automattic/wp-calypso#30434. Jest uses sourcemaps to show error stack traces, which are therefore confusing:

    ReferenceError: regeneratorRuntime is not defined

      at ../../../riad/Workspace/a8c/gutenberg/packages/api-fetch/src/middlewares/fetch-all-middleware.js:42:25
      at Object.<anonymous> (../../../riad/Workspace/a8c/gutenberg/packages/api-fetch/src/middlewares/fetch-all-middleware.js:42:25)
      at Object.<anonymous> (../../../riad/Workspace/a8c/gutenberg/packages/api-fetch/src/index.js:12:1)
      at Object.<anonymous> (client/gutenberg/editor/api-middleware/index.js:9:1)
      at Object.<anonymous> (client/gutenberg/editor/api-middleware/test/index.js:9:1)

(don't pay much attention to the regeneratorRuntime error, it's not related to this bug)

@earnjam
Copy link
Contributor

earnjam commented Feb 15, 2019

I brought this up in Slack a couple of months ago.
https://wordpress.slack.com/archives/C5UNMSU4R/p1540392138000100

Don’t know that we ever made a ticket for it though.

@swissspidy swissspidy added [Type] Bug An existing feature does not function as intended [Type] Build Tooling Issues or PRs related to build tooling Needs Technical Feedback Needs testing from a developer perspective. labels Feb 15, 2019
@jsnajdr
Copy link
Member Author

jsnajdr commented Feb 15, 2019

I don't know what the right solution is. Some projects use webpack: pseudo-URLs, others ship relative paths: ../src/index.js. That's what RxJS does, for example. But they ship the untranspiled sources in src, too, unlike Gutenberg, so the file references are valid.

At least the file paths in the error stacktrace would make more sense:

node_modules/@wordpress/api-fetch/src/middlewares/fetch-all-middleware.js

@gziolo
Copy link
Member

gziolo commented Mar 13, 2019

Fix proposed in #14409.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Technical Feedback Needs testing from a developer perspective. npm Packages Related to npm packages [Type] Bug An existing feature does not function as intended [Type] Build Tooling Issues or PRs related to build tooling
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants