You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: MIGRATION.md
+9Lines changed: 9 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,15 @@ sentryWebpackPlugin({
23
23
});
24
24
```
25
25
26
+
### Replacing `entries` option with `releaseInjectionTargets`
27
+
28
+
Previously, the `entries` option was used to filter for _entrypoints_ that the plugin should inject the release into.
29
+
Releases were only injected into entrypoint files of a bundle.
30
+
In version 2, releases are injected into every module that is part of a bundle.
31
+
Don't worry, your bundler will only include the injected release code once.
32
+
Instead of using the `entries` option to filter for _entrypoints_, the `releaseInjectionTargets` option can now be used to filter for _modules_ that the plugin should inject the release into.
33
+
Matching behaviour stays the same.
34
+
26
35
### Injecting `SENTRY_RELEASES` Map
27
36
28
37
Previously, the webpack plugin always injected a `SENTRY_RELEASES` variable into the global object which would map from `project@org` to the `release` value. In version 2, we made this behaviour opt-in by setting the `injectReleasesMap` option in the plugin options to `true`.
// The MagicString library allows us to generate sourcemaps for the changes we make to the user code.
284
-
constms: MagicString=newMagicString(code);// Very stupid author's note: For some absurd reason, when we add a JSDoc to this hook, the TS language server starts complaining about `ms` and adding a type annotation helped so that's why it's here. (┛ಠ_ಠ)┛彡┻━┻
252
+
constms=newMagicString(code);
285
253
286
-
// appending instead of prepending has less probability of mucking with user'sadly
287
-
// source maps and import statements get to the top anyways
288
-
ms.append(`import "${RELEASE_INJECTOR_ID}";`);
254
+
// Appending instead of prepending has less probability of mucking with user's source maps.
255
+
// Luckily import statements get hoisted to the top anyways.
256
+
ms.append(`;\nimport "${RELEASE_INJECTOR_ID}";`);
289
257
290
258
if(unpluginMetaContext.framework==="esbuild"){
291
259
// esbuild + unplugin is buggy at the moment when we return an object with a `map` (sourcemap) property.
0 commit comments