-
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
React app won't compile after adding Apollo with GraphQL #8178
Comments
@rnnyrk Just to be sure, did you also |
@benjamn Unfortunately I have graphql installed, would've been an easy fix. Reinstalled it as well, no luck. Any other thoughts? |
Still big hurdle for me trying to use Apollo and GraphQL. Any suggestions what I can do or try out? I'd also link my repository which might help out? https://github.com/rnnyrk/graphql-parser/blob/master/config/webpack.config.base.ts |
@rnnyrk update your webpack config to exclude ...
{
exclude: [
/\.[tj]sx?$/,
/\.css$/,
/\.svg$/,
/\.(jpe?g|png|gif)$/i,
/\.json$/,
/\.html$/,
/\.ejs$/,
/\.mjs$/, // ADD THIS
],
use: [{
loader: 'file-loader',
options: { name: 'static/[name].[ext]' },
}],
},
... |
@hwillson Wonderful! This works like charm, thank you! :D |
So it's my first experience with GraphQL and Apollo. I've created a small NodeJS backend serving data with the Apollo server. This works fine, but implementing the API within my React frontend application runs my into unsolvable issues. I created a repository so you can checkout the issue yourself: https://github.com/rnnyrk/graphql-parser
Within this project I try to fetch data from
localhost:4000
, since that's where my Apollo server is running. Although I experience the same issues using the example url: https://48p1r2roz4.sse.codesandbox.ioI've started following the "Getting Started" docs, but the above errors keep coming up. Googeling the warnings, issues like these keep coming up graphql/graphql-js#1272 suggesting adding
.mjs
section to your Webpack rules, or extension resolvers. I tried everything recommended, byt unfortunately nothing seems to works. This is my Webpack setup, the complete file can be found here:The issues occurs directly after starting my front-end application. The GraphQL/Webpack versions and Apollo setup:
Hopefully I supplied enough information. Any idea or recommendations? Kinda stuck now on first implementing it 😓
The text was updated successfully, but these errors were encountered: