I'm working on move my build from vue-cli to vite.
So I got problem with the package that contain part of my app code (package placed in node_modules). In this package I have *.vue and *.graphql files, like source code without any compilation. I import that files and with vue-cli it works well, but with vite i get error:
Error: Build failed with 17 errors:
ERROR: No loader is configured for ".graphql" files: node_modules/<path-to-file>.graphql
...
at failureErrorWithLog (node_modules/esbuild/lib/main.js:1624:15)
at node_modules/esbuild/lib/main.js:1266:28
at runOnEndCallbacks (node_modules/esbuild/lib/main.js:1046:63)
at buildResponseToResult (node_modules/esbuild/lib/main.js:1264:7)
at node_modules/esbuild/lib/main.js:1377:14
at node_modules/esbuild/lib/main.js:678:9
at handleIncomingPacket (node_modules/esbuild/lib/main.js:775:9)
at Socket.readFromStdout (node_modules/esbuild/lib/main.js:644:7)
at Socket.emit (node:events:513:28)
at addChunk (node:internal/streams/readable:315:12)
Although, for my local .graphql files it works without any errors.
And maybe important thing - when I try to use yarn link for this package, it start to works! It's great but I can't use yarn link any time. It looks like bug of vite or maybe of the plugin @rollup/plugin-graphql.
node v16.17.0 (npm v8.15.0)
vite.config.js:
import { defineConfig } from 'vite';
import Vue from '@vitejs/plugin-vue2';
import Graphql from '@rollup/plugin-graphql';
export default defineConfig({
server: {
port: 8011,
},
plugins: [
Graphql(),
Vue(),
],
});
vite: 3.0.9
@rollup/plugin-graphql: 1.1.0
@vitejs/plugin-vue2: 1.1.2