Skip to content

Cannot read properties of undefined (reading 'store') #63006

@mxvsh

Description

@mxvsh

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs TestingNeeds further testing to be confirmed.[Package] Core data/packages/core-data[Status] Needs More InfoFollow-up required in order to be actionable.[Type] BugAn existing feature does not function as intended

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions