-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Import syntax inside node_modules/apollo-client with apollo-client@0.8.1 #1237
Comments
We recently changed the bundle to have UMD, commonjs and es6, so I assume it's related to how you're importing Apollo Client. @kamilkisiela, @calebmer I'm heading out to the mountains today. Can one of you help out here? |
@HriBB First question, which build tool do you use? Webpack, rollup, something different? About that UMD, CommonJS, ES6 Modules thing. In "main": "apollo.umd.js",
"module": "index.js",
"jsnext:main": "index.js", It means that if your build tool wants to use es6 modules, it looks for the Think of
So why we did that? Thanks to having es6 modules we support, for an example tree-shaking. It's useful to keep your app as small as possible. I don't know if you're familiar with SystemJS but it requires to specify all the modules / packages manually. It means, that in each defined package you have to define an entry point. If you will put there |
Now I noticed that you use |
I'm using
I'm not really sure how to handle this in apollo-upload-network-interface, which only uses As for the reproduction, just fork |
@HriBB Which version of webpack? |
Webpack v1. Need to try out v2 soon. Or maybe rollup. |
@HriBB v2 and rollup works okay, I'm testing all the versions right now. With webpack@2.2 you get es6 support by default :) |
@HriBB Webpack@1 works for me: |
OK, I guess I'm doing something wrong. Will try to fix this later this week. |
I'm getting this error (
It was working fine previously with |
Hmm ... this is really weird, but for some reason
Any ideas on how to convince babel to transpile |
If you import something from a nested module of 'apollo-client' it uses a
file that contains es6 modules (import, export).
An example:
```ts
import { abc } from 'apollo-client/nested/module';
```
It will take `/node_modules/apollo-client/nested/module.js`, which has
`import` and `export`.
pon., 6 lut 2017, 15:33 użytkownik Bojan Hribernik <notifications@github.com>
napisał:
… Hmm ... this is really weird, but for some reason apollo-client works on
one project, but does not work on another. Anyway, I'm still having issues
with running mocha tests.
/home/bojan/www/apollo-upload-network-interface/node_modules/apollo-client/transport/networkInterface.js:9
import 'whatwg-fetch';
^^^^^^
SyntaxError: Unexpected token import
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:528:28)
at Module._extensions..js (module.js:565:10)
Any ideas on how to convince babel to transpile node_modules/apollo-client
when running mocha?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1237 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHyfFv1eTOw1wqSNTYqKXgExkSHS6Lg1ks5rZy8igaJpZM4Lv308>
.
|
Yeah I fixed it by adding a setup.js that overrides
I'm closing this issue, because it's not a bug in |
@ne8il I have the same issue with meteor 1.4.2.7 and apollo-client > 0.8.x. Do you found any fix? |
@mimamuh I did not. I tried running kamilkisiela's fix listed above. His sample project runs for me fine locally, but importing those deps into my own meteor project doesn't fix it. I kind of put that on the back burner so I will try again and see if anything's changed. |
@mimamuh I found that the problem centered around having the atmosphere package |
@ne8il Thx for your information. In my case I don't use the |
@ne8il I've solved my issue, too. It was due to importing from a subdirectory which caused the build system to ignore the project.json as @stubailo explained it at the meteor forum. It was a old api anyway I've used. |
Posting my scenario & solution here, hope it helps someone with similar situation. Project environment is TypeScript 2.5.2 and Webpack 3. Scenario: With
Solution: No idea why IntelliJ decided to add |
I was seeing a similar error which was caused by various imports reaching into both To fix, just use the named imports from the root module (ex. |
Thanks @bkoltai, it helped! |
I had this error:
when importing 'apollo-cache-inmemory'
Thanks to @HriBB I added 'exclude' property to my babel-loader in webpack.config like this
...and the issue disappeared |
I might be missing something obvious, but
apollo-client@0.8.1
usesimport
syntax insidenode_modules
and I get an errorThis is the content of
networkInterface.js
insidenode_modules
I might be missing something obvious, so you can close this issue if it's not valid.
The text was updated successfully, but these errors were encountered: