Skip to content

Enable lessify transform (compatability)#412

Closed
MattMcFarland wants to merge 1 commit intoJedWatson:masterfrom
MattMcFarland:patch-1
Closed

Enable lessify transform (compatability)#412
MattMcFarland wants to merge 1 commit intoJedWatson:masterfrom
MattMcFarland:patch-1

Conversation

@MattMcFarland
Copy link

Per the Browserify Handbook + node_modules transforms don't apply across module boundaries.

Since you are using less, it makes good sense to add the browserify transform field to your package.json so other modules that use react-select as a dependency may transform react-select's .less files simply using browserify's native transform configuration. I personally find it more useful to use transforms in the package file instead of adding tasks to my task runner that use external plugins that may go out of date and lose compatibility with browserify.

This pull request adds the transform field to improve compatibility.

[Per the Browserify Handbook](https://github.com/substack/browserify-handbook#browserifytransform-field) -  Since you are using less and react, it makes good sense to use lessify in the package.json just for the sake of optimal compatibility.  Without adding this simple line of code, developers and engineers who are using browserify cannot transform the less files when using package.json.   For the time being, I've had to copy the less files from react-select to my src directory.  However, if you put at least "lessify" in as a transform, reat-select will work for all of us who are using lessify as a transform in our package.json.
@MattMcFarland
Copy link
Author

Please read here too: https://github.com/substack/browserify-handbook#node_modules

If your application had transforms configured in package.json, you'll need to create a separate package.json with its own transform field in your node_modules/foo or node_modules/app/foo component directory because transforms don't apply across module boundaries. This will make your modules more robust against configuration changes in your application and it will be easier to independently reuse the packages outside of your application.

Again, I really thought react-select was broken because the stylesheets would not load when I used require('react-select') - I thought it was just another dud react component that doesnt work but after further investigation I found that your package.json is missing the transform field for browserify. Please add this, if not at least explain why it would be unhelpful to have this.

People using browserify with lessify in package.json instead of transforms in a task-runner could easily dismiss this product as being a dud if they don't investigate.

@MattMcFarland
Copy link
Author

@JedWatson have you looked at this PR yet?

@JedWatson
Copy link
Owner

Thanks for the PR @MattMcFarland

This shouldn't be necessary anymore with our new build system. Please let me know if it's still relevant.

@JedWatson JedWatson closed this Oct 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants