-
Notifications
You must be signed in to change notification settings - Fork 129
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
[DNM] PR to look at -- Rough prototype for extension sourcemaps #4601
base: main
Are you sure you want to change the base?
Conversation
Thanks for your contribution! Depending on what you are working on, you may want to request a review from a Shopify team:
|
Coverage report
Show files with reduced coverage 🔻
Test suite run success1938 tests passing in 873 suites. Report generated by 🧪jest coverage report action from 0a0f80e |
await this.build(options) | ||
|
||
if (this.features.includes('bundling')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use a new feature for this. You can provide it in extensions/specifications/ui_extension.ts
and extensions/specifications/checkout_ui_extension.ts
. 'generates_source_maps'
or such. The reason is I'm not sure all bundling
extensions would support this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the check for this feature should be happening much lower -- in the file below I think, when we're actually calling esbuild
. Consult the feature to decide whether to make a source map or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In terms of where to put the map file:
- it should be the extensions' responsibility to deal with this
- I think
dist
in the extension folder is fine -- it's usually gitignore-d. An alternate would be the.shopify
folder in the root of the app, but I don't think that's necessary here
I would do the pulling out of the map file in the buildAndBundleExtensions
function, prior to zipping:
//...
showTimestamps: false,
})
await Promise.all(
options.app.allExtensions.map((extension) => {
extension.keepBuiltArtifactsLocally({bundleDirectory})
}),
)
if (options.bundlePath) {
//...
```
You'll need to add `keepBuiltArtifactsLocally` to the extension interface. Default implementation should be a no-op. If an extension uses the `generates_source_map` feature, the behaviour should be to glob all the map files for this particular extension from `bundleDirectory` and move them to `joinPath(this.directory, 'dist', <whatever>)`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes a lot of sense, thanks Shaun!
This PR seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. |
Opening PR for a place to put comments.