HAUL does not include 'assets' of other react-native modules
See original GitHub issueCurrent Behavior
React Native app, where used library/module/package with own assets. (In my case OTF fonts) At the current moment font files simply ignored by webpack and untouched.
folder structure of the module:
node_modules/@example/module
├── assets
│ └── fonts
│ └── native
│ ├── ExampleHeadline-Bold.otf
│ ├── ExampleHeadline-Bolditalic.otf
│ ├── ExampleHeadline-Light.otf
│ ├── ExampleHeadline-LightItalic.otf
│ ├── ExampleSans-Bold.otf
│ ├── ExampleSans-BoldItalic.otf
│ ├── ExampleSans-Light.otf
│ ├── ExampleSans-LightItalic.otf
│ ├── ExampleSans-Medium.otf
│ ├── ExampleSans-MediumItalic.otf
│ ├── ExampleSans-Regular.otf
│ └── ExampleSans-RegularItalic.otf
├── build
│ ├── native
│ │ ├── ActionIconArrowBottom
│ │ │ ├── index.js
│ │ │ └── index.js.map
...
├── package.json
├── readme.md
Expected Behavior
font files should be a part of the final bundle/resources.
Haul Configuration (webpack.haul.js)
default
Your Environment
Mac Os
software | version |
---|---|
Haul | 1.0.0-rc.7 |
react-native | |
node | 8.xx |
npm or yarn | yarn |
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:9 (5 by maintainers)
Top Results From Across the Web
React native with haul not working, throwing some loader ...
When i run react-native run-android i see the following error. Can someone help me please. ERROR Failed to compile. ./node_modules/native-base- ...
Read more >Import local packages in React Native using NPM Link and ...
I was setting up a new React Native project and wanted to use some local packages which aren't available on an NPM repository....
Read more >Applying and Organizing Styles in React Native - Manning
Each component supports a specific set of styles. Those styles may be applicable to other types of components. For example, the Text component ......
Read more >Platform Specific Code
React Native provides a module that detects the platform in which the app is running. You can use the detection logic to implement ......
Read more >React Native as a Service
Using Haul we could write a webpack configuration that would allow us to use packages from our internal infrastructure in the React Native...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have refined the test and noticed that in both cases (haul e2e test and repro project) the assets were extracted but to an incorrect path, so I thing that the Asset Resolver is calculating paths incorrectly.
@zamotany I think I have a reproduction case, which might help with debugging. I can see the issue when I produce an iOS bundle, but it appears to work when I produce an Android bundle. I can only reproduce when using a monorepo, where the dependency containing the asset is hoisted.
Repro steps:
yarn
cd packages/HaulTest
yarn haul:ios
At the root of the project there should now be a
bundle
directory, which containsindex.jsbundle
, but no assets.Next, run
yarn haul:android
. Inbundle
there should now be aindex.android.bundle
file, along with the image asset underbundle/drawable-mdpi/node_modules_reacttestimport_src_assets_haul_logo_box_only.png
.Talking with @rdy offline, he noticed that the asset is served by the dev server, but not bundled. Looking at
index.jsbundle
I notice the following code:I’m guessing the
httpServerLocation
being set may be why it’s working in the case where the dev server is being used.