prerender-spa-plugin icon indicating copy to clipboard operation
prerender-spa-plugin copied to clipboard

vue项目添加publicPath后无法build

Open xietongjian opened this issue 5 years ago • 7 comments

image image ,如果将publicPath设置成‘/’就没问题。 想要打包后放入nginx二级目录下,请问如何解决。

xietongjian avatar Aug 18 '19 16:08 xietongjian

I have the same problem, too.

piedasing avatar Sep 23 '19 08:09 piedasing

一样的问题,而且如果不设置publicPath 静态资源的访问也有问题 设置了pubicpath就编译不起

mgluobo avatar Sep 30 '19 01:09 mgluobo

I found a possible solution and wrote about it here. I hope it helps!

26000 avatar Oct 24 '19 06:10 26000

和vue不vue没有关系. 还有这个插件不会影响的你的构建, 因为轮到它执行的时候你的项目已经构建结束了.

light0x00 avatar Jan 02 '20 15:01 light0x00

我也有同样的问题 请问你找到解决的办法了吗? @xietongjian

hyteraesa avatar Feb 19 '20 01:02 hyteraesa

我也遇到了这个问题,vue-cli2,用了几个方法都不行

BobZzz avatar Mar 12 '20 12:03 BobZzz

看来这是一个共性问题。这是由于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

waitkafuka avatar Oct 12 '21 09:10 waitkafuka