Skip to content
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

npm run build 没有替换根目录下的 html文件 #113

Open
minggangLu opened this issue Jun 26, 2019 · 4 comments
Open

npm run build 没有替换根目录下的 html文件 #113

minggangLu opened this issue Jun 26, 2019 · 4 comments

Comments

@minggangLu
Copy link

minggangLu commented Jun 26, 2019

Description

用的sale demo,骨架屏静态页面能生成,运行npm run build 的时候没有将根目录下的 替换为骨架屏样式,是要把根目录下的标签替换调么,如果不替换,怎么将 骨架屏静态页面和真实的页面交替显示(数据没加载出来显示 dist 下的html,加载出来后显示根目录下的页面),还是说这个只是个生成静态骨架屏的工具?

PS:如果整个项目没用vue-router,还能使用该插件生成骨架屏么

@cuilingh00
Copy link

Description

用的sale demo,骨架屏静态页面能生成,运行npm run build 的时候没有将根目录下的 替换为骨架屏样式,是要把根目录下的标签替换调么,如果不替换,怎么将 骨架屏静态页面和真实的页面交替显示(数据没加载出来显示 dist 下的html,加载出来后显示根目录下的页面),还是说这个只是个生成静态骨架屏的工具?

PS:如果整个项目没用vue-router,还能使用该插件生成骨架屏么
同问,快疯了,没人解答

@Jocs
Copy link
Contributor

Jocs commented Oct 17, 2019

可以的。

@1927344728
Copy link

1927344728 commented Nov 12, 2019

项目中没有用vue-router,骨架预览页面空白。浏览器控制台报错:

TypeError: Cannot read property 'html' of undefined
    at a.setCode (bundle.4da48e9f37a58e077c95.js:formatted:15435)
    at fn.e.$emit (bundle.4da48e9f37a58e077c95.js:formatted:2006)
    at _.de.onmessage (bundle.4da48e9f37a58e077c95.js:formatted:16178)
    at _.r.dispatchEvent (bundle.4da48e9f37a58e077c95.js:formatted:13468)
    at bundle.4da48e9f37a58e077c95.js:formatted:16917
    at Array.forEach (<anonymous>)
    at _._transportMessage (bundle.4da48e9f37a58e077c95.js:formatted:16915)
    at c.o.emit (bundle.4da48e9f37a58e077c95.js:formatted:134)
    at WebSocket.ws.onmessage (bundle.4da48e9f37a58e077c95.js:formatted:17590)

TypeError: Cannot read property 'url' of undefined
    at a.<anonymous> (bundle.4da48e9f37a58e077c95.js:formatted:16105)
    at a.e._render (bundle.4da48e9f37a58e077c95.js:formatted:2066)
    at a.n (bundle.4da48e9f37a58e077c95.js:formatted:3436)
    at At.get (bundle.4da48e9f37a58e077c95.js:formatted:1114)
    at At.run (bundle.4da48e9f37a58e077c95.js:formatted:1168)
    at Mt (bundle.4da48e9f37a58e077c95.js:formatted:1053)
    at Array.<anonymous> (bundle.4da48e9f37a58e077c95.js:formatted:834)
    at Ke (bundle.4da48e9f37a58e077c95.js:formatted:800)

配置如下:

new SkeletonPlugin({
  pathname: path.resolve(__dirname, `../html_shell`), // 用来存储 shell 文件的地址
  staticDir: path.resolve(__dirname, '../dist'), // 最好和 `output.path` 相同
  routes: ['/path1/path2/page1.html'], // 将需要生成骨架屏的路由添加到数组中
})

多页面的项目中,routes参数应该怎么来配置?

@katoto
Copy link

katoto commented Jun 1, 2020

还好,看了这个,遇到的坑,都解决了,https://juejin.im/post/5ed4c22ae51d4578810b5459

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants