-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected export #356
Comments
What's giving you that error? Are you trying to load the file in a browser that doesn't support ES6 modules? You'll need to use a module bundler such as Webpack or Rollup for this to work. |
But how can I use spin.js V3 without Webpack or Rollup? |
I'm having this same issue, (unexpected token export) although not with webpack which is working fine, but within my jest tests (scaffolded through create-react-app) Sample repo that demonstrates the problem: https://github.com/thehig/spinjs-unexpectedtokenimport Edit: My guess is something's not being babelified Edit: The 'jest' way to get the tooling to process modules is to use package.json{
....
"jest": {
"transformIgnorePatterns": ["/node_modules/(?!(spin.js\\.js$))"]
}
} |
I'm having the same issue in my tests, using mocha with typescript (actually After some time spent reading up on the issue and the solutions it seems to me that it is premature to publish That (adding a I'll try to get a PR going along those lines in the weekend. |
@tolu More and more libraries are moving to ES6, though, and at some point your tests will have to work with these files. The way I currently work around the lack of Node/IE support is to use ES6 imports in my tests, and then create a test bundle file with Rollup before running it with Mocha. |
This seems like an effective strategy to alienate users |
@theodorejb one important fact here is that when ES6 modules can be understood by Node without the A relatively simple solution seems to be to publish something that everyone can consume, and that includes everyone who has opted in for ES6. But if you are not interested in a PR, I wont bother and keep using v2.3.2 that "just works" 😉 Comprehensive article on the subject: |
A browser-only library that needs nodejs package mechanism to in order to work. Great. |
An updated recommendation now that modules are supported in all major browsers: From: https://developers.google.com/web/fundamentals/primers/modules
|
I am trying to use this in a Django app, with no ES6 or webpack. I cannot simply load spin.js the same way I load a dozen other packages, as the export command is invalid. The website statement "No dependencies" is not true, and IMHO should be changed to reflect that. |
@kgeographer Did you read the website instructions? The Bundling paragraph says the following:
|
I am ashamed to say I did not. For ES5, I needed the full reference |
'Unexpected export' error at line 114 (npm 5.6.0)
Maybe export Spinner directly with 'export const'
The text was updated successfully, but these errors were encountered: