prerender-spa-plugin
prerender-spa-plugin copied to clipboard
vue项目添加publicPath后无法build
,如果将publicPath设置成‘/’就没问题。
想要打包后放入nginx二级目录下,请问如何解决。
I have the same problem, too.
一样的问题,而且如果不设置publicPath 静态资源的访问也有问题 设置了pubicpath就编译不起
I found a possible solution and wrote about it here. I hope it helps!
和vue不vue没有关系. 还有这个插件不会影响的你的构建, 因为轮到它执行的时候你的项目已经构建结束了.
我也有同样的问题 请问你找到解决的办法了吗? @xietongjian
我也遇到了这个问题,vue-cli2,用了几个方法都不行
看来这是一个共性问题。这是由于prerender所启动的服务器找不到js文件导致的。 解决方案是: 在vue.config.js文件,如下:
module.exports = {
publicPath: "/publicPath/",
outputDir: path.join(__dirname, "./dist", "/publicPath/"),
}
这样会在dist目录下生成一个/dist/publicPath这样的文件夹。 对应插件配置为:
const options = {
staticDir: path.join(__dirname, "dist/"), //这里写到dist目录为止
indexPath: path.join(__dirname, "dist/publicPath/index.html"), //重要
}
如果还有问题可以联系我微信zks_1927