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 9c7c11fb54
commit 82b818553e

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