Support external WP dependencies in JSX files (#3209)

This commit is contained in:
csorrentino
2025-01-20 18:02:59 -05:00
committed by GitHub
parent 37e3773d88
commit 3f808812dd

View File

@@ -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) || []),