react-bootstrap will not work with Snowpack bundler
See original GitHub issueDescribe 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
- Go to ‘…’
- Click on ‘…’
- Scroll down to ‘…’
- 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:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top 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 >
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 Free
Top 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
I’m experiencing a similar issue with react-bootstrap/Tabs. Getting error: Uncaught TypeError: (0 , _useMergedRefs.default) is not a function
The problem you described still persists even though I have installed the latest version. How can we solve?
TypeError: (0 , _camelize.default) is not a function at pascalCase (http://localhost:3000/_snowpack/pkg/react-bootstrap.v1.6.4/common/createWithBsPrefix-814b06ea.js:39:55) at createWithBsPrefix (http://localhost:3000/_snowpack/pkg/react-bootstrap.v1.6.4/common/createWithBsPrefix-814b06ea.js:46:51) at http://localhost:3000/_snowpack/pkg/react-bootstrap.Navbar.v1.6.4.js:332:50 at createCommonjsModule (http://localhost:3000/_snowpack/pkg/react-bootstrap.v1.6.4/common/ThemeProvider-4a89d938.js:14:5) at http://localhost:3000/_snowpack/pkg/react-bootstrap.Navbar.v1.6.4.js:295:16