Closed laxity7 closed 8 years ago
You can do the same and specify the transform with the options.global
flag. Just exclude it from your package.json.
you could show on the example of my code as to make it?
b.transform('browserify-shim', {global: true})
It's clear=) how to configure browserify-shim, if to delete from package.json?
Yes, you cannot define global transforms in your package. They must be done programmatically w/ the browserify API.
two questions:
package.json
?package.json
, such babelify
, should all of them be present w/ the api style in program?
- No
If option is not provided in the program, will the API read options in package.json
?
- If you want to apply a transform globally, it cannot be included in package.json
For the given package.json
:
"browserify": {
"transform": ["x", "y", "z"]
}
I found no matter how many transform()
were added in the code, the generated bundle is the same:
browserify()
// enabling any number of the three `transform()` lead to the same result.
// .transform('x')
// .transform('y')
// .transform('z')
.bundle(myOutputStream)
Does it mean browserify()
will load transforms in package.json
not presented in the code?
Options support will come with #195. Browserify will run all transforms every time they're specified, whether via the package or via the API. Some transforms may be able to run multiple times without causing issues, others may not.
@bendrucker:
Yes, you cannot define global transforms in your package. They must be done programmatically w/ the browserify API.
But why not?
In my project I use gulp + browserify + browserify-shim. In the project I connect other libraries which are in the node_modules folder. There is such problem that I and one of libraries use the same dependence - bluebird. But I connect
bluebird
globally, and I don't want to pack. In package.json I have such a ruleBut this rule doesn't extend on others to library and therefore bluebird is all the same packed.
Itself task looks standardly
How to force to distribute this rule globally to any connected libraries and their dependences?
In an ideal it would be desirable to see settings as at babelify, you put
"global":"true"
and everything works, but didn't find such for Browserify-shim