question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Vector icons bloat on react-native-web

See original GitHub issue

Current behaviour

Using with react-native-web (without expo) while requiring react-native-vector-icons adds an additional 1.3MB to the bundle.

Expected behaviour

Would like to use react-native-vector-icons for native builds, while using the fallback for react-native-web builds.

Using the fallback like this, fixes it for me. https://github.com/rahuljayaraman/react-native-paper/commit/7f102d6da0fb1aa56a25cc604c7fcde4a42f5a37

Code sample

import { ListItem } from “react-native-paper”;

Screenshots (if applicable)

N/A

What have you tried

Built with 3 different combinations

Build sizes:

Default CRNA ejected: 409 Kb Import react-native-paper: 1.72 Mb With react-native-paper babel plugin: 1.5 Mb With fallback fork: 658 Kb

Your Environment

  "dependencies": {
    "react": "16.3.1",
    "react-dom": "16.3.1",
    "react-native": "~0.55.2",
    "react-native-paper": "^1.12.0",
    "react-native-vector-icons": "^5.0.0",
    "react-native-web": "^0.4.0",
    "webpack": "^3.11.0",
    "webpack-dev-server": "2.9.4"
  }

I’m not sure if this issue belongs here, react-native-web or something i need to fix using configuration. Would be nice to have some docs nonetheless.

Another solution might involve having a compatibility layer for react-native-vector-icons (using webpack alias perhaps?), similar to how expo-web does it. https://github.com/raarts/expo-web/blob/master/packages/expo-web/src/exports/MaterialIcons/index.js

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
0x006Fcommented, Oct 11, 2018

This is an out-of-the-context question, but @rahuljayaraman , how did you setup the react-native-paper with react-native-web in the first place? I’m trying to do the same, but I’m getting compilation errors.

I tried with create-react-app boilerplate, as well as a vanilla react package with parceljs. Both of them didn’t work. May be can you share a sample repo for me?

When I used create-react-app, it was throwing TypeScript errors whereas while using parceljs, it failed to load ./styles/colors module.

0reactions
rahuljayaramancommented, Sep 3, 2018

I’ll try that, thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native Web issue with react-native-vector-icons
I have made a website in React Native Web. There are two things i am struggling with 1.) React native vector icons not...
Read more >
react-native-web-vector-icons - npm
Customizable Icons for React Native Web with support for NavBar/TabBar/ToolbarAndroid, image source and full styling.
Read more >
How We Reduced Our React App's Load Time by 60% - InfoQ
Using React by itself will not result in a highly performant application. If you're not careful, the application can pick up bloat easily....
Read more >
Let's End the Debate on Icon Fonts vs SVG Icons in 2021
By adjusting the CSS background property, only the required icon is displayed. Sprites proved to be revolutionary for web fonts by solving the ......
Read more >
Create React App is Way Too Bloated - HackerNoon
js ? A quick google search of “service workers” tells me that it has something to do with offline functions and progressive web-apps....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found