vue-strap icon indicating copy to clipboard operation
vue-strap copied to clipboard

SyntaxError: Unexpected token: operator (>) [./~/vue-strap/src/utils/utils.js:4,0]

Open larryu opened this issue 7 years ago • 10 comments

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.

larryu avatar Mar 13 '17 00:03 larryu

Getting the same.

sleman avatar Mar 14 '17 06:03 sleman

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 avatar Mar 14 '17 18:03 sleman

@sleman Awesome, works perfectly. Thanks mate.

larryu avatar Mar 17 '17 05:03 larryu

Please keep this open, needs to get fixed in the repo.

sleman avatar Mar 17 '17 15:03 sleman

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

wffranco avatar Mar 21 '17 14:03 wffranco

Any progress on this? Having the same issue.

lbausch avatar Apr 03 '17 22:04 lbausch

@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. selection_008

josiahdahl avatar May 08 '17 03:05 josiahdahl

@josiahdahl Thanks for the explanation.

larryu avatar May 08 '17 08:05 larryu

@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!!

vesper8 avatar May 11 '17 13:05 vesper8

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

larryu avatar May 12 '17 01:05 larryu