Skip to content

[Bug]: Importing getRecordConsolePlugin version 2.0.0-alpha.18, and referencing it crashes chrome extension content script. #1772

@seeniolabode

Description

@seeniolabode

Preflight Checklist

  • I have searched the issue tracker for a bug report that matches the one I want to file, without success.

What package is this bug report for?

Other (specify below)

Version

@rrweb/rrweb-plugin-console-record: 2.0.0-alpha.18

Expected Behavior

I want to import and use the console recorder plugin, as it provides in the recipes:

import rrweb from 'rrweb';
import { getRecordConsolePlugin } from '@rrweb/rrweb-plugin-console-record';

rrweb.record({
  emit: function emit(event) {
    // you should use console.log in this way to avoid errors.
    const defaultLog = console.log['__rrweb_original__']
      ? console.log['__rrweb_original__']
      : console.log;
    defaultLog(event);
  },
  // to use default record option
  plugins: [getRecordConsolePlugin()],
});

Actual Behavior

All is well until I run my extension in the dev environment, I find that the content script doesn't run at all, possibly indicating a crash during the build process, perhaps some operation is being run within the package version that throws an error. My content script widget doesn't appear.

Steps to Reproduce

  • Create an extension project
  • Install @rrweb/rrweb-plugin-console-record: 2.0.0-alpha.18 as a dependency
  • Use this in a content script
  • Go to browser to see if it crashes

Testcase Gist URL

No response

Additional Information

I downgraded to version @rrweb/rrweb-plugin-console-record: 2.0.0-alpha.15, and my code is now working as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions