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

can not transform react in react-redux #209

Closed
Tankpt opened this issue Apr 21, 2016 · 5 comments
Closed

can not transform react in react-redux #209

Tankpt opened this issue Apr 21, 2016 · 5 comments

Comments

@Tankpt
Copy link

Tankpt commented Apr 21, 2016

Here is my config

"dependencies":{
  "react": "^0.14.0",
  "react-dom": "^0.14.0",
  "react-redux": "^4.0.4",
  "redux": "^3.0.0",
},
"devDependencies":{
  "browserify": "~13.0.0",
  "browserify-shim": "~3.8.12",
},
"browserify": {
  "transform": [ "browserify-shim" ]
},
"browserify-shim": {
  "react": "global:React",
  "react-dom": "global:ReactDOM"
},
browserify -x react -x react-dom -s redux -e ./node_modules/react-redux > redux.js

I still find require('react') in the build file

var _react = require('react');
@Tankpt
Copy link
Author

Tankpt commented Apr 21, 2016

I just find in react-redux package.jon .
react do not as a dependencies but as a peerDependencies 。
In npm3 peerDependencies will not install?

Will this peerDependencies caus the error?

@bendrucker
Copy link
Collaborator

Hard to say without code. We'll need a reproducible project to look further.

@Tankpt
Copy link
Author

Tankpt commented Apr 22, 2016

Thanks for you reply.
And I made a demo as follow. https://github.com/Tankpt/react-redux
I just package the react-redux with 'npm run redux'.

@bendrucker
Copy link
Collaborator

Ah. Browserify doesn't transform stuff in your node_modules folder. You have to run it as a global transform:

{
  "name": "react-redux",
  "version": "0.0.1",
  "description": "",
  "main": "index.js",
  "scripts": {
    "redux": "rm -rf react-redux.js && browserify -g browserify-shim -x react -s ReactRedux -e ./node_modules/react-redux > react-redux.js"
  },
  "repository": {
    "type": "git",
    "url": "git@github.com:Tankpt/react-redux.git"
  },
  "keywords": [],
  "license": "MIT",
  "homepage": "https://github.com/Tankpt/react-redux",
  "dependencies": {
    "react-redux": "^4.0.4",
    "redux": "^3.0.0"
  },
  "devDependencies": {
    "browserify": "~13.0.0",
    "browserify-shim": "~3.8.12"
  },
  "browserify-shim": {
    "react": "global:React"
  }
}

@Tankpt
Copy link
Author

Tankpt commented May 2, 2016

Thx

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