Reputation: 467
I'm trying to run grunt-browserify
. I keep getting the "path must be a string" error.
Here's my browserify
task:
browserify: {
dist: {
files: {
"build/Hotspot.js" : ["lib/**/*.js"]
},
options: {
transform: ["babelify", {
presets: "es2015"
}]
}
}
},
This returns a Path must be a string
error. However, if I change files
to
"build/Hotspot.js" : ["/lib/**/*.js"]
the task runs, but none of the code seems to be transpiled or bundled. build/Hotspot.js
is just the standard browserify error handling and nothing else.
Is there something I've done wrong in setting up my Gruntfile
?
edit 1: I should note that lib/
exists and has files in it. Also, "./lib/**/*.js"
yields the same error.
Upvotes: 2
Views: 584
Reputation: 8993
I think the clue to the solution is in the grunt-browserify docs, specifically:
Transforms can also be provided with an options hash; in this case, the transform should be specified as an array of [transformStringOrFn, optionsHash].
I think this is telling us that in order to pass the options hash to a transform, the options.tranform
value must be an array of arrays:
transform: [
["babelify", { presets: "es2015" }]
]
Upvotes: 2