I have a nodeJS Apollo server and the server is working fine when I run in development mode. But when I use webpack to build for production I get the following error.
Error: Query root type must be provided.
at Un (C:\xxxxxx\dist\index.js:2:1612273)
at Function.generateSchemaDerivedData (C:\xxxxxx\dist\index.js:2:1248625)
at Object.schemaDerivedDataProvider (C:\xxxxxx\dist\index.js:2:1243311)
at new t.SchemaManager (C:\xxxxxx\dist\index.js:2:1323703)
at new N (C:\xxxxxx\dist\index.js:2:1243228)
at Object.63607 (C:\xxxxxx\dist\index.js:2:1138699)
at __webpack_require__ (C:\xxxxxx\dist\index.js:2:2367097)
at C:\xxxxxx\dist\index.js:2:2368032
at Object.<anonymous> (C:\xxxxxx\dist\index.js:2:2368060)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
I have a basic webpack setup:
const path = require('path');
module.exports = {
entry: './src/index.ts',
mode: 'development',
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js', '.mjs'],
},
output: {
filename: 'index.js',
path: path.resolve(__dirname, 'dist'),
},
target: 'node',
optimization: {
usedExports: true,
}
};
Here is a screen shot of my schema.