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

[RFC] prod --source-maps should be decoupled #319

Closed
2 tasks done
leotronolone opened this issue Dec 1, 2022 · 4 comments · Fixed by #339
Closed
2 tasks done

[RFC] prod --source-maps should be decoupled #319

leotronolone opened this issue Dec 1, 2022 · 4 comments · Fixed by #339
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@leotronolone
Copy link

What happened?

The issue:

Running the following command to generate sourcemaps for a prod build does not generate js source map files:
plasmo build --source-maps

I also attempted the following combinations with no luck:
plasmo build --env production --source-maps
plasmo build --env prod --source-maps
plasmo build --env="production" --source-maps
plasmo build --env="prod" --source-maps
NODE_ENV=production plasmo build --source-maps

Steps to reproduce:

  1. Pull down the following forked repo: https://github.com/leotronolone/plasmo-examples
  2. Run cd with-background
  3. Run npm install
  4. Run plasmo build --source-maps
  5. Check contents of build/chrome-mv3-dev or build/chrome-mv3-prod for missing source map files

Findings

I noticed the artifact folder in build is always set to chrome-mv3-dev when using the --env param. It seems to only do a prod named build chrome-mv3-dev if we set NODE_ENV=production. Wondering if there is an issue with how env is being set?

Run with plasmo build --source-maps
Screen Shot 2022-11-30 at 5 15 54 PM

Run with NODE_ENV=production plasmo build --source-maps
Screen Shot 2022-11-30 at 5 15 54 PM

Related changes: #189

Version

Latest

What OS are you seeing the problem on?

MacOSX

What browsers are you seeing the problem on?

Chrome

Relevant log output

No response

(OPTIONAL) Contact Details

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I checked the current issues for duplicate problems.
@leotronolone leotronolone added the bug Something isn't working label Dec 1, 2022
@louisgv
Copy link
Contributor

louisgv commented Dec 1, 2022

All sourcemap are "inlined," primarily for dev-runtime instruments. Tho, this issue raised an interesting point - should sourcemap for prod be inlined or decoupled into sourcemap files?

I noticed the artifact folder in build is always set to chrome-mv3-dev when using the --env param. It seems only to do a prod named build chrome-mv3-dev if we set NODE_ENV=production. Wondering if there is an issue with how env is being set?

Oh shoot I need to release a new patch! #307 fixed that but I went on to try to fix #313 and haven't make a release since...

@louisgv
Copy link
Contributor

louisgv commented Dec 1, 2022

@leotronolone 0.59.2 just released, and should address the build issue you are observing.

@leotronolone
Copy link
Author

@louisgv thanks for the quick response!! Just verified your fix on the latest build 👍

Gotcha, to give you more context I am trying to upload source maps to sentry so that we can see de-minified stack traces/files.

For our use case decoupling mappings into separate files or having the option to do so would be nice! Inline mappings do work with sentry but we would have to remove them before deployment(our extension will be public so we don't want our code to be public).

I also tried running the build without --source-maps to see if we could just do 2 builds(1 for sentry, 1 for deployment) but it generated a different content hash between builds, causing the file names to mis-match/breaking sentry file mapping.

@louisgv
Copy link
Contributor

louisgv commented Dec 2, 2022

Got it, I think this will be an RFC instead of BUG. It makes sense for sourcemap to be separated in prod imo since it's likely be used to instrument remotely instead of locally.

@louisgv louisgv changed the title [BUG] --source-maps not working [RFC] prod --source-maps should be decoupled Dec 2, 2022
@louisgv louisgv added enhancement New feature or request help wanted Extra attention is needed and removed bug Something isn't working labels Dec 2, 2022
@louisgv louisgv self-assigned this Dec 15, 2022
louisgv added a commit that referenced this issue Dec 15, 2022
* chore: bump deps

* moving prod sourcemap to separate files, fix #319

* bump canary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants