fgnass / spin.js

A spinning activity indicator
http://spin.js.org
MIT License
9.3k stars 1.02k forks source link

Unexpected token { #349

Closed ratajs closed 6 years ago

ratajs commented 6 years ago

inport {Spinner} from '/spin.js-3.1.0/spin.js'

davidlmorris commented 6 years ago

I'm getting this when uglifing a bundle:

[07:05:20] 'minify-js' errored after 958 ms
[07:05:20] GulpUglifyError: unable to minify JavaScript
Caused by: SyntaxError: Unexpected token: punc ({)
File: C:\Work\Quoxient\Source\QSoar\QSoar\js\qt_bundle_charting.js
Line: 42780

...which corresponds to line 113/114 in the dist of version 3.10.0.

jbmonroe commented 6 years ago

Concur--and the use of import rather than require breaks using this in Electron. Not in a position to use either webpack or Rollup--this build is already complicated enough.

chrishearn commented 6 years ago

Same issue with Meteor JS. Meteor's build tool doesn't transpile code in node_modules directory so the browser throws this error as it doesn't understand the ES6 module syntax.

theodorejb commented 6 years ago

Perhaps you can stick with spin.js 2.x until your build tools support ES6. They'll have to support it eventually since more and more libraries are starting to use it!

chrishearn commented 6 years ago

@theodorejb Thanks for the suggestion - that's exactly what I'm doing for the moment :) I've just discovered that transpiling of node_modules is on the roadmap for the next Meteor release (v1.6.2) so that should solve it properly (for Meteor users at least).

moretti commented 6 years ago

Getting the same error and had to downgrade to v2. In webpack you typically exclude node_module from babel-loader, as it's a common convention to publish transpiled modules to npm, so this module won't work with create-react-app for example.

mmurray22 commented 6 years ago

How do you downgrade to v2?

moretti commented 6 years ago

@MMP3AC3 you can run yarn upgrade spin.js@^2.0.0 or npm install spin.js@^2.0.0

mmurray22 commented 6 years ago

@moretti I downgraded to v2, but it's still not working...not sure if I'm doing this right

thehig commented 6 years ago

Is it the typo inport should be import?