Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal Library errors, due to dependancies allowing React 15.4 #21

Closed
matthewoden opened this issue Nov 17, 2016 · 4 comments
Closed

Comments

@matthewoden
Copy link

matthewoden commented Nov 17, 2016

React 15.4 changes the internals of react, and react-dom. For both of these dependancies, react-stonecutter uses ^15.3.2 instead of ~15.3.2.

Using ^ allows npm to skip up to the latest minor version, thus using react 15.4.0. If this dependency changed to ~, stonecutter would stop at 15.3.N, where N is the last published version of 15.3.

(I'd love just make a pull request for what's basically a one-character change, but sadly I'm on a company-owned machine right now with all kinds of restrictions on open source stuff)

@matthewoden matthewoden changed the title React-Stonecutter breaks via React 15.4 Internal Library errors, due to dependancies allowing React 15.4 Nov 17, 2016
@matthewoden
Copy link
Author

matthewoden commented Nov 17, 2016

I guess it'd help to point out where I got the issue:

Console:
Uncaught Error: Cannot find module "react-dom/lib/ReactDOM" ReactAddonsDOMDependencies.js:13

Source Map:

/**
 * Copyright 2013-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 *
 */

'use strict';

var ReactDOM = require('react-dom/lib/ReactDOM'); // < -- this line right here errors out
var ReactInstanceMap = require('react-dom/lib/ReactInstanceMap');

exports.getReactDOM = function () {
  return ReactDOM;
};

exports.getReactInstanceMap = function () {
  return ReactInstanceMap;
};

if (process.env.NODE_ENV !== 'production') {
  var ReactPerf = require('react-dom/lib/ReactPerf');
  var ReactTestUtils = require('react-dom/lib/ReactTestUtils');

  exports.getReactPerf = function () {
    return ReactPerf;
  };

  exports.getReactTestUtils = function () {
    return ReactTestUtils;
  };
}


/*****************
 ** WEBPACK FOOTER
 ** ./~/react-stonecutter/~/react/lib/ReactAddonsDOMDependencies.js
 ** module id = 844
 ** module chunks = 0
 **/```

@matthewoden
Copy link
Author

And just to clarify - no stonecutter code is at fault here. This is just a sad side effect of react messing with itself across versions. If a project has 15.3 dependancies and react 15.4 dependancies, while on npm 2.x (still common for those of us on Node LTS), require resolutions start going haywire.

@dantrain
Copy link
Owner

dantrain commented Nov 18, 2016

Hi, I'd like to help but I'm a little confused. I've updated my react and react-dom packages to 15.4.0 and everything is working in the demo. If I change from ^15.3.2 to ~15.3.2 this will not allow using the latest version of react with stonecutter. Surely I don't want that?

Can you not fix the version of react in your project to 15.3.2, and this will still satisfy the stonecutter peer dependency? Sorry if I'm missing something.

@matthewoden
Copy link
Author

So that's the weird thing - we DO use 15.3.2, and there's no peer dependency resolution happening. npm still installs stonecutter with react 15.4.0, and freaking out about missing /lib/ modules.

...Maybe I need to read a refresher on npm's dependency resolution.

And you're right - as a library, it'd actually be terrible to limit which react version you need. I suppose you could do some version patching to support react 15.3.X and react 15.4.X, but that's WAY more confusing for users than it is helpful.

For now, I suppose my best course of action is just forking stonecutter for our use until this 15.4 behavior stuff is resolved (or our apps all get up to speed with node 6 LTS, and we can use npm 3 for dependency management).

Thanks for the quick reply! I'll go ahead and close this.

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

No branches or pull requests

2 participants