diff --git a/packages/create-block/CHANGELOG.md b/packages/create-block/CHANGELOG.md index e86cd049c301a0..77477d6f0067cf 100644 --- a/packages/create-block/CHANGELOG.md +++ b/packages/create-block/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Bug Fix + +- Fix support for external templates hosted on npm. + ## 1.0.0 (2020-12-17) ### Breaking Changes diff --git a/packages/create-block/lib/templates.js b/packages/create-block/lib/templates.js index b926d20739aa35..3d286f0e15880f 100644 --- a/packages/create-block/lib/templates.js +++ b/packages/create-block/lib/templates.js @@ -7,11 +7,6 @@ const { readFile } = require( 'fs' ).promises; const { fromPairs, isObject } = require( 'lodash' ); const { join } = require( 'path' ); -/** - * WordPress dependencies - */ -const lazyImport = require( '@wordpress/lazy-import' ); - /** * Internal dependencies */ @@ -98,9 +93,9 @@ const getBlockTemplate = async ( templateName ) => { info( '' ); info( 'Downloading template files. It might take some time...' ); - const { defaultValues = {}, templatesPath } = await lazyImport( - templateName - ); + await command( `npm install ${ templateName } --no-save` ); + + const { defaultValues = {}, templatesPath } = require( templateName ); if ( ! isObject( defaultValues ) || ! templatesPath ) { throw new Error(); }