Replace utils/console
with @wordpress/warning
and install babel plugin for code elimination
#595
Labels
💻 aspect: code
Concerns the software code in the repository
✨ goal: improvement
Improvement to an existing user-facing feature
🟩 priority: low
Low priority and doesn't need to be rushed
🧱 stack: frontend
Related to the Nuxt frontend
Problem
We've written our own simple
console
module that exports a silenced version of the console methods. However, the raw strings we're passing are still in the app even though they're being unused in production, meaning it's wasted bytes we're sending to the client.Description
Let's switch to using the
@wordpress/warning
package and also enable the eslint rule to prevent usingconsole
directly. The@wordpress/warning
package has a corresponding babel plugin that eliminates calls to it including the strings instead of just silencing them.Alternatives
Implement our own version of this.
Implementation
The text was updated successfully, but these errors were encountered: