Skip to content
This repository has been archived by the owner on Oct 10, 2022. It is now read-only.

Commit

Permalink
📦 NEW: External @wordpress/api-fetch
Browse files Browse the repository at this point in the history
Allows using the external wp.apiFetch method. Otherwise, if you try to import it from the @wordpress/api-fetch package, it won't have the REST API base URL initialized.

Example of usage:

import apiFetch from '@wordpress/api-fetch';
 
apiFetch( { path: '/wp/v2/posts' } ).then( posts => {
    console.log( posts );
} );
  • Loading branch information
moreira-dev authored and ahmadawais committed Nov 8, 2019
1 parent 715dd8d commit 40584db
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/cgb-scripts/config/externals.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const camelCaseDash = string => string.replace( /-([a-z])/g, ( match, letter ) =
*/
const externals = [
'components',
'api-fetch',
'edit-post',
'element',
'plugins',
Expand Down

2 comments on commit 40584db

@ankitsingh101
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i thinl dotenv file should be there atleast for externals config for webpack

@ahmadawais
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go ahead build one and send in a PR>

Please sign in to comment.