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.

react-bootstrap will not work with Snowpack bundler

See original GitHub issue

Describe the bug

Trying to use Snowpack bundler with React and react-bootstrap. If you attempt to use navbar with dropdowns (or also modals) your will get an error (This is tested against fresh snowpack build using

npx create-snowpack-app my-project --template @snowpack/app-template-react

If you attempt to add a Navbar, eg : from docs


<Navbar bg="light" expand="lg">
  <Navbar.Brand href="#home">React-Bootstrap</Navbar.Brand>
  <Navbar.Toggle aria-controls="basic-navbar-nav" />
  <Navbar.Collapse id="basic-navbar-nav">
    <Nav className="mr-auto">
      <Nav.Link href="#home">Home</Nav.Link>
      <Nav.Link href="#link">Link</Nav.Link>
      <NavDropdown title="Dropdown" id="basic-nav-dropdown">
        <NavDropdown.Item href="#action/3.1">Action</NavDropdown.Item>
        <NavDropdown.Item href="#action/3.2">Another action</NavDropdown.Item>
        <NavDropdown.Item href="#action/3.3">Something</NavDropdown.Item>
        <NavDropdown.Divider />
        <NavDropdown.Item href="#action/3.4">Separated link</NavDropdown.Item>
      </NavDropdown>
    </Nav>
    <Form inline>
      <FormControl type="text" placeholder="Search" className="mr-sm-2" />
      <Button variant="outline-success">Search</Button>
    </Form>
  </Navbar.Collapse>
</Navbar>

The following error is produced

Unhandled Runtime Error
Uncaught TypeError: (0 , _camelize.default) is not a function

Source
http://localhost:8080/_snowpack/pkg/react-bootstrap.v1.6.0/common/Dropdown-70f399dd.js [:903:55]
TypeError: (0 , _camelize.default) is not a function
    at pascalCase (http://localhost:8080/_snowpack/pkg/react-bootstrap.v1.6.0/common/Dropdown-70f399dd.js:903:55)
    at createWithBsPrefix (http://localhost:8080/_snowpack/pkg/react-bootstrap.v1.6.0/common/Dropdown-70f399dd.js:910:51)
    at http://localhost:8080/_snowpack/pkg/react-bootstrap.v1.6.0/common/Dropdown-70f399dd.js:976:54
    at createCommonjsModule (http://localhost:8080/_snowpack/pkg/react-bootstrap.v1.6.0/common/Dropdown-70f399dd.js:26:5)
    at http://localhost:8080/_snowpack/pkg/react-bootstrap.v1.6.0/common/Dropdown-70f399dd.js:939:18

error

  1. Go to ‘…’
  2. Click on ‘…’
  3. Scroll down to ‘…’
  4. See error

Environment (please complete the following information)

  • Operating System: Windows
  • Browser, Version Chrome Version 90.0.4430.212 (Official Build) (64-bit)
  • React-Bootstrap Version: 17.0.2

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
Axfordcommented, Oct 13, 2021

I’m experiencing a similar issue with react-bootstrap/Tabs. Getting error: Uncaught TypeError: (0 , _useMergedRefs.default) is not a function

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack and bundlers · Bootstrap v5.0
Learn how to include Bootstrap in your project using Webpack or other bundlers.
Read more >
Jack Works 🕊️ on Twitter: "vite since Snowpack crashes ...
Hours ago I try to bundle react-bootstrap, it fails again for tons of error message I don't know why. I tried to use...
Read more >
Replacing Create-React-App With Snowpack | by Cheri Hung
The step-by-step guide to replacing CRA with Snowpack, a light-weight, fast and forward-looking bundler.
Read more >
How JavaScript works: understanding Snowpack, the next ...
And it requires no configuration because Snowpack builds your application before sending it to the bundler. So the bundler's only job is to ......
Read more >
React-Bootstrap with Webpack not working from react-starter-kit
You need to add the bootstrap CSS manually : Because React-Bootstrap doesn't depend on a very precise version of Bootstrap, we don't ship ......
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