-
Notifications
You must be signed in to change notification settings - Fork 29
prpl-server
not working out of the box
#24
Comments
Hey Alex, thanks for trying it out! Try adding |
Although, trying this out myself now, I see that with I think there's a bit of a conflict with how Will need to think about this a bit. I guess the first question is whether we think it's important to preserve the behavior in the starter kit where you can serve multiple apps from different subdirectories on the same host? |
@aomarks, I think I have that part figured out. In a meeting right now, but let's catch up this morning. |
Any update? |
@slightlyoff, the tl;dr is that we identified some incremental changes we needed to land in both the tools and the templates to make everything work out of the box. The tools-side changes landed yesterday, I believe (@aomarks can confirm). The template-side changes have open PRs that we still need to finish up and land. |
Same error here. After
But when I access to this URL doesn't find any resource inside
As server detects what index.html send should do the same with bower_components. I don't think that change the |
Try adding a "build" section and a "name" variable to your polymer.json.
I serve with: EDIT: This is in response to @jorgecasar EDIT2: My apologies, I think I misunderstood your initial issue. |
@jorgecasar Check out the documentation on base paths. Also take a look at the shop example app, which follows the base path pattern and works well with prpl-server. |
I found the errors and this is the checklist to make it work in yours projects:
|
The PSK 2.0 demo app (which I reported the original issue against) also sets the base path to Nor does it use absolute URLs. @aomarks: can you please post step-by-step directions for demonstrating that the Shop demo works? Will re-attempt from my end using that template, but want to understand what we might be doing differently. |
Here are the exact commands I ran:
This output a single build target:
...which is not exactly helpful in determining if the PRPL pattern is supported. The default {
"entrypoint": "index.html",
"shell": "src/shop-app.html",
"fragments": [
"src/shop-list.html",
"src/shop-detail.html",
"src/shop-cart.html",
"src/shop-checkout.html",
"src/lazy-resources.html"
],
"sourceGlobs": [
"src/**/*",
"data/**/*",
"images/**/*",
"bower.json"
],
"includeDependencies": [
"manifest.json",
"bower_components/webcomponentsjs/webcomponents-lite.min.js"
]
} I modified it to include multiple build targets like so: {
"entrypoint": "index.html",
"shell": "src/shop-app.html",
"fragments": [
"src/shop-list.html",
"src/shop-detail.html",
"src/shop-cart.html",
"src/shop-checkout.html",
"src/lazy-resources.html"
],
"sourceGlobs": [
"src/**/*",
"data/**/*",
"images/**/*",
"bower.json"
],
"includeDependencies": [
"manifest.json",
"bower_components/webcomponentsjs/webcomponents-lite.min.js"
],
"extraDependencies": [
"manifest.json",
"bower_components/webcomponentsjs/*.js"
],
"builds": [
{
"preset": "es5-bundled"
},
{
"preset": "es6-unbundled"
}
]
} This correctly built multiple targets:
...which I then tried to serve:
Loading this in the browser shows the same errors as before (see attached image): Please advise. |
You're missing "name" and "baseHref" in your build section. Name is for it to know what to name the build I believe, and "baseHref":true will make it actually do the change after building. |
My initial |
I also edited my previous comment just a little bit |
Thanks for the leads @Nitrus! Now we're getting somewhere. Here's the updated
I also updated
This largely works when served from the source directory using:
Some latent absolute URLs need to be weeded out: A few things are now clear:
Suggest leaving this issue open until the Thanks again for the help, all. |
Sorry this was unclear! Shop at In the meantime, this should work: $ git clone git@github.com:Polymer/shop.git
$ cd shop
$ vim polymer.json # add {basePath: true} to the two builds
$ polymer install
$ polymer build
$ cd build
$ prpl-server |
We should have We still do have a rough edge related to |
Waiting on Polymer/polymer-cli#782 to get the changes to shop I mentioned. |
|
Did you think about include the base tag in the build process (polymer build) if it doesn't exist? If the tag doesn't exist and property basePath is true, then create tag and set with the correct value. |
To use this pattern, you need to have made all your static resource hrefs relative, and in that case you really need a base tag set to |
We've added a new |
Hey all,
Was having trouble with static resources in a personal project using
prpl-server
as an NPM module. To re-create the issue, I've tried to boil things down to the simplest possible test case and repro. Here's what I did:polymer-2-starter-kit
template viapolymer init
polymer build
prpl-server --root ./build/ --config ./build/polymer.json
http://127.0.0.1:8080/
What should happen: the root file and sub-resources should all be served correctly
What does happen: only the root file is correctly selected. Subresources all 404
I modified the default
polymer.json
to include build rules. Here's the whole file:/cc @justinfagnani @aomarks @graynorton
The text was updated successfully, but these errors were encountered: