IjzerenHein / react-native-bundle-visualizer

See what packages are increasing your react-native bundle size 📦
MIT License
1.46k stars 44 forks source link

Does not seem to work with Expo #19

Closed paldepind closed 5 years ago

paldepind commented 5 years ago

I'm having trouble getting this to work in a RN project using Expo. I've been able to reproduce the error I'm seeing in a brand new Expo project so I think the issue happens in general.

Steps to reproduce:

Problem encountered: I get the error below. It seems that the bundler can't find the AppEntry.js file included in Expo. Expo projects contain "main": "node_modules/expo/AppEntry.js", in package.json and this file is included in the Expo npm package.

multi ./node_modules/haul/src/vendor/polyfills/Object.es6.js ./node_modules/haul/src/vendor/polyfills/console.js ./node_modules/haul/src/vendor/polyfills/error-guard.js ./node_modules/haul/src/vendor/polyfills/Number.es6.js ./node_modules/haul/src/vendor/polyfills/String.prototype.es6.js ./node_modules/haul/src/vendor/polyfills/Array.prototype.es6.js ./node_modules/haul/src/vendor/polyfills/Array.es6.js ./node_modules/haul/src/vendor/polyfills/Object.es7.js ./node_modules/haul/src/vendor/polyfills/babelHelpers.js ./node_modules/react-native/Libraries/Core/InitializeCore.js node_modules/expo/AppEntry.js
Module not found: Error: Can't resolve 'node_modules/expo/AppEntry.js' in '/home/simon/projects/bundle-test'
resolve 'node_modules/expo/AppEntry.js' in '/home/simon/projects/bundle-test'
 Parsed request is a module
 using description file: /home/simon/projects/bundle-test/package.json (relative path: .)
   Field 'browser' doesn't contain a valid alias configuration
   resolve as module
     /home/simon/projects/node_modules doesn't exist or is not a directory
     /home/simon/node_modules doesn't exist or is not a directory
     /home/node_modules doesn't exist or is not a directory
     /node_modules doesn't exist or is not a directory
     looking for modules in /home/simon/projects/bundle-test/node_modules
       using description file: /home/simon/projects/bundle-test/package.json (relative path: ./node_modules)
         Field 'browser' doesn't contain a valid alias configuration
         using description file: /home/simon/projects/bundle-test/package.json (relative path: ./node_modules/node_modules/expo/AppEntry.js)
           no extension
             Field 'browser' doesn't contain a valid alias configuration
             /home/simon/projects/bundle-test/node_modules/node_modules/expo/AppEntry.js doesn't exist
           .ios.js
             Field 'browser' doesn't contain a valid alias configuration
             /home/simon/projects/bundle-test/node_modules/node_modules/expo/AppEntry.js.ios.js doesn't exist
           .native.js
             Field 'browser' doesn't contain a valid alias configuration
             /home/simon/projects/bundle-test/node_modules/node_modules/expo/AppEntry.js.native.js doesn't exist
           .js
             Field 'browser' doesn't contain a valid alias configuration
             /home/simon/projects/bundle-test/node_modules/node_modules/expo/AppEntry.js.js doesn't exist
           as directory
             /home/simon/projects/bundle-test/node_modules/node_modules/expo/AppEntry.js doesn't exist
[/home/simon/projects/node_modules]
[/home/simon/node_modules]
[/home/node_modules]
[/node_modules]
[/home/simon/projects/bundle-test/node_modules/node_modules/expo/AppEntry.js]
[/home/simon/projects/bundle-test/node_modules/node_modules/expo/AppEntry.js.ios.js]
[/home/simon/projects/bundle-test/node_modules/node_modules/expo/AppEntry.js.native.js]
[/home/simon/projects/bundle-test/node_modules/node_modules/expo/AppEntry.js.js]
@ multi ./node_modules/haul/src/vendor/polyfills/Object.es6.js ./node_modules/haul/src/vendor/polyfills/console.js ./node_modules/haul/src/vendor/polyfills/error-guard.js ./node_modules/haul/src/vendor/polyfills/Number.es6.js ./node_modules/haul/src/vendor/polyfills/String.prototype.es6.js ./node_modules/haul/src/vendor/polyfills/Array.prototype.es6.js ./node_modules/haul/src/vendor/polyfills/Array.es6.js ./node_modules/haul/src/vendor/polyfills/Object.es7.js ./node_modules/haul/src/vendor/polyfills/babelHelpers.js ./node_modules/react-native/Libraries/Core/InitializeCore.js node_modules/expo/AppEntry.js main[10]
IjzerenHein commented 5 years ago

Hi, thanks for the repro steps. I was able to repro this and am going to take a look. cheers

IjzerenHein commented 5 years ago

Hi, I've resolved the issues with Expo projects: https://github.com/IjzerenHein/react-native-bundle-visualizer/releases/tag/v1.4.2

Let me know whether you still have any errors with your project. Cheers

IjzerenHein commented 5 years ago

Hi, can I close this?

paldepind commented 5 years ago

Hi @IjzerenHein. Thanks a lot for taking a look at this issue. That definitely fixes the issue reproduced by the steps I gave :+1: So, yes, it looks like this can be closed :smile:

IjzerenHein commented 5 years ago

Awesome 😄