Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tree shaking causes error with Vite #511

Open
JonathanMSifleet opened this issue Apr 12, 2022 · 0 comments
Open

Tree shaking causes error with Vite #511

JonathanMSifleet opened this issue Apr 12, 2022 · 0 comments

Comments

@JonathanMSifleet
Copy link

Default example:

import Bowser from "bowser";
...
const browser = Bowser.getParser(window.navigator.userAgent);
 
console.log(`The current browser name is "${browser.getBrowserName()}"`);
// The current browser name is "Chrome"

With tree-shaking:

import { getParser } from "bowser";

const browser = getParser(window.navigator.userAgent);
 
console.log(`The current browser name is "${browser.getBrowserName()}"`);

Output:
Uncaught SyntaxError: The requested module '/node_modules/.vite/deps/bowser.js?v=8b59587e' does not provide an export named 'getParser'

vite: 2.9.1
bowser: 2.11.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant