vue-strap
vue-strap copied to clipboard
SyntaxError: Unexpected token: operator (>) [./~/vue-strap/src/utils/utils.js:4,0]
When runing command npm run production, I got the following error.
/js/app.js from UglifyJs SyntaxError: Unexpected token: operator (>) [./~/vue-strap/src/utils/utils.js:4,0]
But when I ran npm run dev, it was fine. Any idea and suggestion? Thanks.
Getting the same.
Only fix is to transpile only this one file which makes me think this was done by mistake:
./node_modules/.bin/babel node_modules/vue-strap/src/utils/utils.js --presets es2015 > node_modules/vue-strap/src/utils/utils.js
@sleman Awesome, works perfectly. Thanks mate.
Please keep this open, needs to get fixed in the repo.
not sure what you do here :rofl:
@sleman please if you can make a pull request, then I can check it and understand whats going on :v
Any progress on this? Having the same issue.
@larryu I ran into a very similar issue when trying to test with Karma. Here's the overview:
// src/components/MyComponent.vue
// What I did
import Modal from 'vue-strap/src/Modal';
export default {
...
components: { Modal },
...
}
// The right way
import { modal } from 'vue-strap';
export default {
...
components: { modal },
// You might have to do components: { Modal: modal }
...
}
The problem is that by importing from the source folder (as suggested by the docs), you include the file `~/vue-strap/src/utils/utils.js' which doesn't get compiled by the third-party plugin.
Something that may lead to the problem is that the keys used to import the components are named in camel case, instead of the usual Pascal case. This is fine, but I don't think it is explicit in the documentation.
@wffranco would you be open to updating the documentation? I've been using this fork for a while and I like it a lot. I can submit a PR in the next week or so.
For quick reference, here are the components available.
@josiahdahl Thanks for the explanation.
@josiahdahl oh god this issue has been causing me so much grief for the last 3 hours!!! and this was it!! arrgh.. thanks a lot for sharing your solution!!
For those who have the same issue. The following is the another solution if you use Laravel-mix. https://github.com/JeffreyWay/laravel-mix/issues/631