A babel plugin for extracting VTEX Render route information from a component
If you write the following:
import route from 'vtex.renderjs/route.js' // Your React component code here// Let's call this component 'Home' 'home' '/'Home
It will extract the information on the parameters provided for the
route function and append it to the babel's file
With the example above it would create something like this:
file metadata // Various babel's properties vtexRender route name: 'home' path: '/'
For the extraction to be succesful it depends on some rules:
- You must make a default
- The arguments given for the imported function must be string literals, for now we're not accepting variables or expressions
The name of the function isn't fixed, sou you're not required to use the name
route (as written on our example).