FredKSchott / snowpack

ESM-powered frontend build tool. Instant, lightweight, unbundled development. ✌️
https://www.snowpack.dev
MIT License
19.48k stars 921 forks source link

Will not work with react-bootstrap #3367

Open Intelliflex opened 3 years ago

Intelliflex commented 3 years ago

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
yarn add react-bootstrap

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)

Intelliflex commented 3 years ago

I also posted this on react-bootstrap issues and got the following response

Not really familiar with snowpack, but it looks like it didn't include dom-helpers lib which RB depends on. This issue might be worth filing over at the snowpack git repo.