I need to disable the panel "Page Attributes" from the page editor (Gutenberg)
What do I need to change on your code to work properly?
And most important, in which file do I place the piece of code?
This is your code:

wp.domReady( () => {
const { removeEditorPanel } = wp.data.dispatch('core/edit-post');

// Remove featured image panel from sidebar.
removeEditorPanel( 'featured-image' );
} );