I might be wrong but i couldn't find any solution to give some custom options to my custom babel plugin. Do you have any clue how i could achieve this ?
Here is my building process, i'm using gulp with browserify and babelify :
gulp.task("scripts", function() {
return browserify({
entries: "myFile.js"
})
.transform(babelify.configure({
plugins: ["./lib/myPlugin:after"]
}))
.bundle()
.pipe(source("all.js"))
.pipe("build/");
});
I would like to give some custom data to my plugin, doing something like this :
gulp.task("scripts", function() {
return browserify({
entries: "myFile.js"
})
.transform(babelify.configure({
myCustomOptions: {
rootPath: "some path",
customInfo: "..."
}
plugins: ["./lib/myPlugin:after"]
}))
.bundle()
.pipe(source("all.js"))
.pipe("build/");
});
Then in my plugin, i would like to retrieve the customOptions object i just declared. Would there be a way to achieve something like that ?
Thanks,
Regards
This has changed recently in Babel 6. From the docs:
Plugin Options documentation in the Babel plugin handbook.