我正在尝试使用webpack将我的反应应用解析到我的index.html中,但是我一直收到以下错误:ERROR in Template execution failed: ReferenceError: window is not defined
到目前为止我有什么
的客户机/公共/ index.html中
<!DOCTYPE html>
<html>
<head>
<title>Anon's Website</title>
</head>
<body>
<div id="root"><%=
require('../appPrerender.js')
%></div> // EJS format
</body>
</html>
的客户机/ appPrerender.js
import App from './app';
import React from 'react';
import ReactDOMServer from 'react-dom/server';
module.exports = ReactDOMServer.renderToString(<App/>);
webpack.common.js(摘录)
plugins: [new HtmlWebpackPlugin({
template: '!!ejs-loader!'+path.join(__dirname,'client/public/index.html')
})]