-
-
Notifications
You must be signed in to change notification settings - Fork 384
做 vue 服务端渲染,生产环境运行 报错 document is not defined #295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Please use English language |
I collect a solution solving this problem |
use extract-css-chunks-webpack-plugin instead mini-css-extract-plugin webpack.base.config.js const ExtractCssChunksPlugin = require('extract-css-chunks-webpack-plugin')
{
...
{
test: /\.css$/,
use: [
{
loader: ExtractCssChunksPlugin.loader,
options: {
hot: !isProd,
reloadAll: !isProd
}
},
'postcss-loader',
'css-loader'
]
},
{
test: /\.less$/,
use: [
{
loader: ExtractCssChunksPlugin.loader,
options: {
hot: !isProd,
reloadAll: !isProd
}
},
'css-loader',
'postcss-loader',
'less-loader'
]
}
...
plugins: [
...
new ExtractCssChunksPlugin({
filename: isProd ? 'css/[name].[contenthash:8].css' : '[name].css',
chunkFilename: isProd ? 'css/[name].[contenthash:8].chunk.css' : '[name].chunk.css'
})
]
} webpack.server.config.js {
...
plugins: [
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1
})
]
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
执行 yarn run build 后运行打开网页报如下错误,
但是开发环境是正常的。
下面是我的配置文件
webpack.base.config.js
以下是 webpack.client.config.js
看了 #90 这个issues 但是还是不知道如何解决。
The text was updated successfully, but these errors were encountered: