Polymer Web应用程序未呈现任何组件 [英] Polymer web app is not rendering any of the components

查看:86
本文介绍了Polymer Web应用程序未呈现任何组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个React应用,该应用使用带有react-polymer的Google的Material Design Polymer组件.通过webpack-dev-server运行我的应用程序时,所有Polymer组件均正确呈现.

I've created a React app that uses Google's Material Design Polymer components with react-polymer. When running my app through the webpack-dev-server, all Polymer components are rendering properly.

但是一旦将其上传到digitalocean上的Apache2服务器上,所有组件都将无法呈现.我没有收到任何未提取资产的网络错误.起初,我以为是mod_pagespeed剥夺了我的样式和Polymer导入,但是禁用它却无济于事.

But once I upload this to my Apache2 server on digitalocean, none of the components are rendering at all. I'm not receiving any network errors either of assets not being fetched. At first, I thought it was the mod_pagespeed that was stripping my styles and Polymer imports, but disabling it didn't help.

我尝试使用基本的node.js服务器在本地服务我的站点,并且再次,Polymer组件未呈现.

I've tried serving my site locally with a basic node.js server and again, the Polymer components aren't rendering.

我还硫化了我的html文件,将导入内容直接嵌入其中.这个硫化的文件在我的本地webpack-dev-server上可以成功工作,但是再次无法在我的本地node.js服务器和我在digitalocean上的Apache2服务器.

I've also vulcanized my html file, embedding the imports right in. This same vulcanized file works successfully on my local webpack-dev-server, but again fails to render the polymer components on both my local node.js server and my Apache2 server on digitalocean.

webpack-dev-server有什么特别之处,它可以让Polymer元素呈现?

What's so special about the webpack-dev-server that's allowing it the Polymer elements to render?

我确定我会忽略一些非常基本的内容.有帮助吗?

I'm sure I'm overlooking something extremely basic. Any help?

推荐答案

愚蠢的错误.我发现webpack-dev-server会将所有内容编译到内存,而不是编译到磁盘.我一直在所有其他服务器上运行旧的bundle.js文件.重新运行webpack以重新编译所有内容,可以解决此问题.

Dumb mistake. I figured out that webpack-dev-server was compiling everything to memory, but not to disk. I was running my older bundle.js file in all the other servers all along. Re-running webpack to recompile everything fixed the problem.

webpack-dev-server 文档:

从内存中的相对路径提供此修改后的捆绑包 在publicPath中指定(请参阅API).它不会被写入您的 配置的输出目录.捆绑包已经存在于同一位置的地方 URL路径,内存中的捆绑包优先(默认情况下).

This modified bundle is served from memory at the relative path specified in publicPath (see API). It will not be written to your configured output directory. Where a bundle already exists at the same URL path, the bundle in memory takes precedence (by default).

这篇关于Polymer Web应用程序未呈现任何组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆