Popper-core: Angular 4. Unexpected token export

Created on 8 Sep 2017  Â·  7Comments  Â·  Source: popperjs/popper-core

i have node 8.4.0, npm 5.4.1, angular-cli v 1.3.2
Steps to reproduce the problem:

  1. ng new web
  2. npm install --save jquery
  3. npm install --save popper.js
  4. in ./.angular-cli.js annd this:

"scripts": [
"../node_modules/jquery/dist/jquery.min.js",
"../node_modules/popper.js/dist/popper.js"
],

  1. ng serve, and after got error in console (without popper.js all good, but i need it for bootstrap 4-beta):

VM1018:2297 Uncaught SyntaxError: Unexpected token export
at eval ()
at webpackJsonp.../../../../script-loader/addScript.js.module.exports (addScript.js:9)
at Object.../../../../script-loader/index.js!../../../../popper.js/dist/popper.js (popper.js?6efa:1)
at __webpack_require__ (bootstrap 88f7324…:54)
at Object.2 (scripts.bundle.js:66)
at __webpack_require__ (bootstrap 88f7324…:54)
at webpackJsonpCallback (bootstrap 88f7324…:25)
at scripts.bundle.js:1
webpackJsonp.../../../../script-loader/addScript.js.module.exports @ addScript.js:9
../../../../script-loader/index.js!../../../../popper.js/dist/popper.js @ popper.js?6efa:1
__webpack_require__ @ bootstrap 88f7324…:54
2 @ scripts.bundle.js:66
__webpack_require__ @ bootstrap 88f7324…:54
webpackJsonpCallback @ bootstrap 88f7324…:25
(anonymous) @ scripts.bundle.js:1

if i add bootstrap before popper.js, bootstrap says that he need popper.js

Most helpful comment

dist/esm/popper.js if you use modern version of webpack.
Dist/umd/popper.js otherwise

All 7 comments

You should use the esm build with webpack

@FezVrasta can you help me a little bit more? What does it mean use the esm build? Any link for example how to configure ang4 app to esm build?

dist/esm/popper.js if you use modern version of webpack.
Dist/umd/popper.js otherwise

@FezVrasta yahoo= ) umd version for me =) Now no error in console)Big thanks!

@FezVrasta thanks a lot

@FezVrasta i try with both but always in console i see an error

my project is with angular v7, and lasted angular-cli

using last webpack version
if i put ./node_modules/popper.js/dist/esm/popper.js" or "node_modules/popper.js/dist/esm/popper.js"

image

another try with "node_modules/popper.js/dist/umd/popper.js" or "./node_modules/popper.js/dist/umd/popper.js"

image

i will use for now firts form because lookslike a more simple error

I tried keeping both usm emd in the path of script, it's still not working for me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Madhu94 picture Madhu94  Â·  3Comments

Sawtaytoes picture Sawtaytoes  Â·  5Comments

skitterm picture skitterm  Â·  5Comments

NilsEnevoldsen picture NilsEnevoldsen  Â·  5Comments

cixonline picture cixonline  Â·  5Comments