TypeError: m._compiler is not a function
来源:2-8 开发时的服务端渲染

505380967
2018-10-15
const Module = module.constructor
const mfs = new MemoryFs
const serverCompiler = webpack(serverConfig)
serverCompiler.outputFileSystem = mfs
let serverBundle
serverCompiler.watch({},(err,stats) => {
if(err) throw err
stats = stats.toJson()
stats.errors.forEach(err => console.error(err))
stats.warnings.forEach(warn => console.warn(warn))
const bundlePath = path.join(
serverConfig.output.path,
serverConfig.output.filename
)
const bundle = mfs.readFileSync(bundlePath,'utf-8')
const m = new Module()
m._compiler(bundle,'server-entry.js')
serverBundle = m.default
})
跟着视频一步步来的,webpack是4.启动dev:server时报错,m._compiler is not a function
写回答
1回答
-
应该是m._compile吧
012018-10-16
相似问题