Skip to content

Commit 1214c93

Browse files
authored
ref(component-annotate): Use default export (#478)
* ref(component-annotate): Use default export
1 parent 73147a7 commit 1214c93

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

packages/babel-plugin-component-annotate/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Or alternatively, configure the plugin by directly importing it:
6969
```js
7070
// babel.config.js
7171

72-
import {componentNameAnnotatePlugin} from '@sentry/babel-plugin-component-annotate';
72+
import componentNameAnnotatePlugin from '@sentry/babel-plugin-component-annotate';
7373

7474
{
7575
// ... other config above ...

packages/babel-plugin-component-annotate/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ type IgnoredComponent = [file: string, component: string, element: string];
5959

6060
type AnnotationPlugin = PluginObj<AnnotationPluginPass>;
6161

62-
export function componentNameAnnotatePlugin({ types: t }: typeof Babel): AnnotationPlugin {
62+
// We must export the plugin as default, otherwise the Babel loader will not be able to resolve it when configured using its string identifier
63+
export default function componentNameAnnotatePlugin({ types: t }: typeof Babel): AnnotationPlugin {
6364
return {
6465
visitor: {
6566
FunctionDeclaration(path, state) {

packages/babel-plugin-component-annotate/test/test-plugin.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525

2626
import { transform } from "@babel/core";
27-
import { componentNameAnnotatePlugin as plugin } from "../src/index";
27+
import plugin from "../src/index";
2828

2929
const BananasPizzaAppStandardInput = `import React, { Component } from 'react';
3030
import { StyleSheet, Text, TextInput, View, Image, UIManager } from 'react-native';

packages/bundler-plugin-core/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import SentryCli from "@sentry/cli";
22
import { transformAsync } from "@babel/core";
3-
import { componentNameAnnotatePlugin } from "@sentry/babel-plugin-component-annotate";
3+
import componentNameAnnotatePlugin from "@sentry/babel-plugin-component-annotate";
44
import * as fs from "fs";
55
import * as path from "path";
66
import MagicString from "magic-string";

0 commit comments

Comments
 (0)