Skip to content
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

fs wheter not resolved or undefined #7

Closed
swunderlich opened this issue Jan 22, 2019 · 3 comments
Closed

fs wheter not resolved or undefined #7

swunderlich opened this issue Jan 22, 2019 · 3 comments

Comments

@swunderlich
Copy link

Hi,

I'm using this package with nuxt (apollo-server-express) and experience the following issue:

If I don't set:

build: { analyze: false, extend: (config) => { config.node = { fs: 'empty' } } }

i get:

Module not found: Error: Can't resolve 'fs' in

setting it resolved the issue until updated all packages yesterday. Now the browser logs:

app.js:970 [nuxt] Error while initializing app TypeError: Class extends value undefined is not a constructor or null at Module.<anonymous> (core_data.8fb92f55.js:35632) at Module../node_modules/fs-capacitor/lib/index.mjs (core_data.8fb92f55.js:35816) at __webpack_require__ (runtime.js:787) at fn (runtime.js:150) at Module.<anonymous> (core_data.8fb92f55.js:41785) at Module../node_modules/graphql-upload/lib/processRequest.mjs (core_data.8fb92f55.js:42016) at __webpack_require__ (runtime.js:787) at fn (runtime.js:150) at Module../node_modules/graphql-upload/lib/index.mjs (core_data.8fb92f55.js:41754) at __webpack_require__ (runtime.js:787)

I know that your code is correct and that the error must be somewhat webpack / browser related. Maybe you have a hint for me. Otherwise I'll upate this issue as soon as I found an solution.

@swunderlich
Copy link
Author

swunderlich commented Jan 22, 2019

It's related to the use of serverMiddleware in nuxt.js. Isolating the backend removes this error. Nuxt tries to load apollo-server-express in the browser somehow but fs isn't available in browsers.

@swunderlich
Copy link
Author

I was wrong. The issue still remains. Any ideas?

@swunderlich swunderlich reopened this Jan 22, 2019
@swunderlich
Copy link
Author

swunderlich commented Jan 22, 2019

For anyone who may have the same problem. I used gql from apollo-server-express. This includes graphql-upload which (now?) relies on fs-capacitor which includes fs. Since fs is not for the browser the error message made total sense. Switched to gql from graphql-tag and everything is fine. Good thing is my api is separated now 🙈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant