0

In my project if I include bootstrap's javascrpt file via

app.import(app.bowerDirectory + '/bootstrap/dist/js/bootstrap.min.js'); in ember-cli-build.js I get a bunch of js errors.

If instead I include it in index.html it works fine. Any idea what could be causing this?

Error-

SyntaxError: export declarations may only appear at top level of a module

1 Answer 1

1

I can think of 3 things to try here:

Link to the full file. I had this line in a (pretty old) app that worked fine: app.import(app.bowerDirectory + '/bootstrap/dist/js/bootstrap.js');

Make sure you app.import is inside of the main module.exports declaration in your ember cli build.

You might also try testing it out with a different bower package to see if the problem is bootstrap or your app.

If all else fails (and even if it succeeds), I highly recommend using ember bootstrap instead. It will handle the stylesheets for you and provide some Ember friendly ways to implement bootstrap components. You won't need to do the import anymore. Overall, it's best to avoid mixing libraries that modify the DOM (like plain bootstrap) with ember components. http://www.ember-bootstrap.com

Sign up to request clarification or add additional context in comments.

1 Comment

I don't remember how I fixed this in the end. Or what was causing it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.