Bootstrap 4, Popper.JS, and WebPack -- "import and export may appear only with sourceType: module" -


i had project working bootstrap@4.0.0-alpha6. tried upgrading project bootstrap@4.0.0-beta , noticed new dependency on popper.js instead of tether.

i updated package.json include popper.js@^1.11.0 , updated code from:

window.tether = require("tether"); require("bootstrap"); 

to:

window.popper = require("popper.js"); require("bootstrap"); 

now i'm getting following error:

./~/popper.js/dist/esm/popper.js module build failed: syntaxerror: 'import' , 'export' may appear 'sourcetype: module' (2429:0)     @ parser.pp$4.raise (/project/node_modules/acorn/dist/acorn.js:2610:13)     @ parser.pp$1.parsestatement (/project/node_modules/acorn/dist/acorn.js:782:16)     @ parser.pp$1.parsetoplevel (/project/node_modules/acorn/dist/acorn.js:690:23)     @ parser.parse (/project/node_modules/acorn/dist/acorn.js:543:15)     @ parse (/project/node_modules/acorn/dist/acorn.js:3670:37)     @ module.exports (/project/node_modules/falafel/index.js:22:15)     @ /project/node_modules/static-module/index.js:30:13     @ concatstream.<anonymous> (/project/node_modules/concat-stream/index.js:36:43)     @ emitnone (events.js:91:20)     @ concatstream.emit (events.js:185:7)  @ ./resources/assets/js/common/bootstrap.js 12:16-36  @ ./resources/assets/js/website/app.js 

i'm not super familiar or @ using webpack. forced upon me laravel 5.4, i've been floundering until point. webpack.config.js file looks so:

module.exports = {   devtool: "source-map",   module: {     loaders: [       {         test: /\.js/,         loader: "transform?brfs"       }     ]   } } 

you have use umd build located in dist/umd folder of popper.js: (dist/umd/popper.js or dist/umd/popper.min.js)

the following answer helped me issue bootstrap 4 , popper, take here: how use popper 1.12.0 bootstrap 4.0 beta

also, i'm using angularcli, uses webpack. changing path dist dist/umd has solved issue.

i hope you.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -