我看到这个:
[HMR] Updated modules:
[HMR] - ./src/resolvers.js
[HMR] Update applied.
但是什么都没有更新。我已经尝试了一些我在网上找到的关于 webpack 的 output.publicPath 的其他解决方案。我不知道还能做什么,很快我就要投入生产了。重新启动服务器不是我的选择。
我的代码:
import express from 'express'
import { execute, subscribe } from 'graphql';
import { ApolloServer } from 'apollo-server-express'
import schema from './schema';
import typeDefs from './typeDefs'
import resolvers from './resolvers'
import getUserByToken from './getUserByToken';
const app = express();
const path = '/graphql';
const server = new ApolloServer({ typeDefs, resolvers, });
server.applyMiddleware({ app });
server.listen(8081, () => {
console.log(` Server ready at http://localhost:${PORT}${server.graphqlPath}`)
console.log(` Subscriptions ready at ws://localhost:${PORT}${server.subscriptionsPath}`)
})
let currentApp = app
if (module.hot) {
module.hot.accept(['./index', './resolvers'], () => {
server.removeListener('request', currentApp);
server.on('request', app);
currentApp = app;
});
}
谢谢!