Support external WP dependencies in JSX files (#3209)
This commit is contained in:
@@ -86,7 +86,7 @@ export function wordpressPlugin() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
transform(code, id) {
|
transform(code, id) {
|
||||||
if (!id.endsWith('.js')) return
|
if ((!id.endsWith('.js')) && !id.endsWith('.jsx')) return
|
||||||
|
|
||||||
const imports = [
|
const imports = [
|
||||||
...(code.match(/^import .+ from ['"]@wordpress\/[^'"]+['"]/gm) || []),
|
...(code.match(/^import .+ from ['"]@wordpress\/[^'"]+['"]/gm) || []),
|
||||||
|
|||||||
Reference in New Issue
Block a user