gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Cannot read properties of undefined (reading 'store')

Open mxvsh opened this issue 7 months ago • 0 comments

Description

Package @wordpress/core-data isn't working. It returns undefined when I try to import it in a TypeScript project.

Here's ny TSConfig

{
	"compilerOptions": {
		"jsx": "react-jsx",
		"module": "ESNext",
		"target": "ES2016",
		"strict": true,
		"allowSyntheticDefaultImports": true,
		"moduleResolution": "node"
	}
}

Step-by-step reproduction instructions

  1. Install @wordpress/core-data
  2. Add following code
import { store } from '@wordpress/core-data';
console.log('store', store);
  1. You should get an error.

Screenshots, screen recording, code snippet

Code:

Screenshot 2024-07-01 at 14 00 23

Result:

Screenshot 2024-07-01 at 13 58 04

Environment info

  • Wordpress Version: 6.5.5
  • I am building a custom theme (Clone of 2024)

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

mxvsh avatar Jul 01 '24 08:07 mxvsh