Closed xueruini closed 8 years ago
Hi,
I looked around in the issue list, and find there are bunch of cannot find module errors. I also got one, a little bit different:
cannot find module
Here is my package.json (browserify and shim part):
package.json
"devDependencies": { "babel-preset-react": "6.1.2", "babelify": "7.2.0", "browserify-shim": "3.8.11", "react-immutable-render-mixin": "^0.8.1" }, "browserify": { "transform": [ [ "babelify", {"presets": [ "react" ] } ], "browserify-shim" ] }, "browserify-shim": { "jquery": "global:jQuery", "immutable": "global:Immutable", "react": "global:React", }
Here is my demo.js code:
demo.js
var x = require('react-immutable-render-mixin');
Tested with:
BROWSERIFYSHIM_DIAGNOSTICS=1 browserify -d demo.js -o x.js
Output:
{ file: '~/Documents/xxx/a.js', info: { package_json: '~/Documents/xxx/package.json', packageDir: '~//Documents/xxx', shim: undefined, exposeGlobals: { jquery: 'jQuery', immutable: 'Immutable', react: 'React'}, browser: undefined, 'browserify-shim': { jquery: 'global:jQuery', immutable: 'global:Immutable', react: 'global:React'}, dependencies: {} }, messages: [ { resolved: {} } ] } Error: Cannot find module 'immutable' from '~/Documents/xxx/node_modules/react-immutable-render-mixin' at /usr/local/lib/node_modules/browserify/node_modules/resolve/lib/async.js:46:17 at process (/usr/local/lib/node_modules/browserify/node_modules/resolve/lib/async.js:173:43) at ondir (/usr/local/lib/node_modules/browserify/node_modules/resolve/lib/async.js:188:17) at load (/usr/local/lib/node_modules/browserify/node_modules/resolve/lib/async.js:69:43) at onex (/usr/local/lib/node_modules/browserify/node_modules/resolve/lib/async.js:92:31) at /usr/local/lib/node_modules/browserify/node_modules/resolve/lib/async.js:22:47 at FSReqWrap.oncomplete (fs.js:82:15)
However, when I change the demo.js to:
var x = require('jquery'); // or // var x = require('react');
There is no error report. Have no idea.
In order to transform a dependency instead of your application code you'll need a global transform (see #191)
Hi,
I looked around in the issue list, and find there are bunch of
cannot find module
errors. I also got one, a little bit different:Here is my
package.json
(browserify and shim part):Here is my
demo.js
code:Tested with:
Output:
However, when I change the
demo.js
to:There is no error report. Have no idea.