Popper-core: Uncaught SyntaxError: Unexpected token export

Created on 19 Sep 2017  路  10Comments  路  Source: popperjs/popper-core

After reading this repository's README and the documentation section of the website I am forced to report this.

I tried to include this library in my page because Bootstrap requires it, but I got this error:
Uncaught SyntaxError: Unexpected token export

The script tag importing Popper is <script type="text/javascript" src="js/popper.min.js"></script> and the file is the regular release download.

Is there a proper way of including this file that I'm not aware of? Alternatively, if there is a way to use Bootstrap without requiring this library, that would work for me too. Thanks.

Most helpful comment

use script file under the umd directory ,"popper.js/dist/umd/popper.min.js" instead of "popper.js/dist/popper.min.js""

All 10 comments

Damn. As soon as I wrote this I tried downloading the file available through cdnjs instead of the one released on your website and the problem disappeared. Sorry.

There's a whole section in the readme that explains how to use the provided scripts...

from stack overflow: https://stackoverflow.com/questions/45646101/bootstrap4-dependency-popperjs-throws-error-on-angular

" if you look at the bootstrap page (http://getbootstrap.com/) one can see that they import the following:https://code.jquery.com/jquery-3.2.1.slim.min.js https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js "
this works for me.

use script file under the umd directory ,"popper.js/dist/umd/popper.min.js" instead of "popper.js/dist/popper.min.js""

I ran aground in to this too. Thanks @fishen. I was using dist/popper.js, now with dist/umd/popper.min.js in its place, I'm no longer having issues.

I suspect from a kind of HCI vantage point, this may come up for folks routinely. I know... I know.. _GTFO || RTFM(mf)_.

fishen wrote a better solution:
Try to copy 'popper.js/dist/umd/popper.min.js'

"scripts": [ "../node_modules/jquery/dist/jquery.min.js", "../node_modules/popper.js/dist/esm/popper.min.js", "../node_modules/bootstrap/dist/js/bootstrap.min.js" ]
not fixed :( i already used /umd/

Happening to me as well, installed in an ASP.Net app using VS2015 and Nuget, disabled typescript compilation as well.

I just got it working, seems the real problem is things that are lauded to make things easier, but actually cause a ton of other development and developers staring at error messages all day because they're all disparate opensource projects with complex dependencies. Anyway, Rant over! To get this working I just imported the UMD script in index.html old-school, along with bootstrap, jquery, and tether.. All to get a dropdown working. There are a ton of Bootstrap 4 examples for angular, but none of them work (javascript, not CSS, dropdown in navbar specifically)- even in the plunkers. 5 hours wasted, but I hope this helps someone.

Was this page helpful?
0 / 5 - 0 ratings