You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to use graphql-voyager component render fail with message: Failed to load resource: the server responded with a status of 404 (Not Found)
#16681
Open
7 tasks done
LizGabriela-RY opened this issue
May 14, 2024
· 3 comments
We are migrating our UI from webpack": "4.41.2" ("node": "^16") to use "vite": "~5.1.4" ("node": "^20",). We have migrated almost all the functionality and components without any issue except "graphql-voyager", we use this as schema visualizer tool running with version "graphql-voyager": "1.0.0-rc.31" however in the vite version we cant make this tool to run due to message mentioned above.
In first instance we tried importing module directly in the component: import {Voyager} from 'graphql-voyager';
This makes the all app to failed as it did not find a specific library: http://localhost:3000/node_modules/.vite/deps/graphql-voyager.js?v=5ad894e5
After some investigation we try an workaround using vite-plugin-legacy. Adding the following configuration to vite: import legacy from '@vitejs/plugin-legacy' export default { plugins: [ legacy({ targets: ['defaults', 'not IE 11'] }) ] }
And using dynamic import: import('graphql-voyager').then((Voyager) => { // Use Voyager here })
This solved the issue of the all app failing however still thrown similar imessage when trying to navigate to the specific component that use Voyager. Message in this case will be: Uncaught (in promise) TypeError: Failed to fetch dynamically imported module: http://localhost:3000/node_modules/.vite/deps/graphql-voyager.js?v=488bd6e1
Note in both cases file and folder exist in node_modules but it seems it is not recognise or process by vite. We have tried from "graphql-voyager": "1.0.0-rc.31" to lates available "graphql-voyager": "^2.0.0".
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
Hello @LizGabriela-RY. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with needs reproduction will be closed if they have no activity within 3 days.
Describe the bug
We are migrating our UI from webpack": "4.41.2" ("node": "^16") to use "vite": "~5.1.4" ("node": "^20",). We have migrated almost all the functionality and components without any issue except "graphql-voyager", we use this as schema visualizer tool running with version "graphql-voyager": "1.0.0-rc.31" however in the vite version we cant make this tool to run due to message mentioned above.
In first instance we tried importing module directly in the component:
import {Voyager} from 'graphql-voyager';
This makes the all app to failed as it did not find a specific library: http://localhost:3000/node_modules/.vite/deps/graphql-voyager.js?v=5ad894e5
After some investigation we try an workaround using vite-plugin-legacy. Adding the following configuration to vite:
import legacy from '@vitejs/plugin-legacy' export default { plugins: [ legacy({ targets: ['defaults', 'not IE 11'] }) ] }
And using dynamic import:
import('graphql-voyager').then((Voyager) => { // Use Voyager here })
This solved the issue of the all app failing however still thrown similar imessage when trying to navigate to the specific component that use Voyager. Message in this case will be:
Uncaught (in promise) TypeError: Failed to fetch dynamically imported module: http://localhost:3000/node_modules/.vite/deps/graphql-voyager.js?v=488bd6e1
Note in both cases file and folder exist in node_modules but it seems it is not recognise or process by vite. We have tried from "graphql-voyager": "1.0.0-rc.31" to lates available "graphql-voyager": "^2.0.0".
Reproduction
https://stackblitz.com/edit/vitejs-vite-uvwuz8?file=main.js
Steps to reproduce
Try adding directly the import to the graphql-voyager or import dynamically after setting vite-plugin-legacy
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: