Reputation: 463
I am trying to apply babel plugin on code source something like this
code = require('babel-core').transform(code, {
plugins: ['some plugin']
})
above code is var that contains actual code as a string, what is the right way to do above?
Upvotes: 1
Views: 161
Reputation: 366
This example shows how you can transform your code according to different babel plugins.
Using babel-core transform method (you already doing).
Output will be transpiled code according to babel-plugin.
You can refer to this link for more babel methods.
Hope it helps you :)
Upvotes: 3