Git Product home page Git Product logo

Comments (14)

papandreou avatar papandreou commented on September 26, 2024

That's a bug. Relations pointing at non-existent assets should be left alone. I think what's happening is that AssetGraph cannot work out the asset type of user because it doesn't have an extension, so it tries to load it in order to detect the mime type using file -b --mime-type. I'll take a look at it!

Temporary workaround:

<script>document.write('<script src="user"><\/script>');</script>

Referring to user.js instead would probably also work.

from assetgraph-builder.

mreinstein avatar mreinstein commented on September 26, 2024

@papandreou cool that workaround fixed it. Thanks!

from assetgraph-builder.

mreinstein avatar mreinstein commented on September 26, 2024

Question, is it also a bug that non-existent assets are getting put into the generated manifest? In my example, user.js is not found, but when I add the --manifest command line option I see user.js get into the manifest file. This breaks my app because its telling the browser to cache a resources that needs to be dynamic, which is why its intentionally a missing reference in the first place.

from assetgraph-builder.

papandreou avatar papandreou commented on September 26, 2024

Yeah, that's a bug, fixed in assetgraph/assetgraph@5402b9e -- thanks :)

from assetgraph-builder.

mreinstein avatar mreinstein commented on September 26, 2024

I'm thinking it makes sense to rename this issue to "relations pointing to non-existing assets should be ignored" and tag it as a bug. I want to make sure these tickets are actionable and closable.

from assetgraph-builder.

papandreou avatar papandreou commented on September 26, 2024

Sure, go for it!

from assetgraph-builder.

Munter avatar Munter commented on September 26, 2024

I just want to make sure that this issue won't remove the functionality that tells me when I am actually pointing to a missing file during a static build. I find it quite useful that I can't build an application that isn't complete.

from assetgraph-builder.

mreinstein avatar mreinstein commented on September 26, 2024

@Munter absolutely, I don't mean to imply that failed links should fail silently. What Ireally mean is that if an asset can't be found, it shouldnt be putting non existent references into the manifest file (and any other places.)

So in the case of my app, the references to backbone.js, underscore.js and user.js wouldnt appear in the manifest. I'll update the title to try to make this more clear.

from assetgraph-builder.

mreinstein avatar mreinstein commented on September 26, 2024

@papandreou I think this may have regressed in 1.2.2. I updated to 1.2.2, reran my deploy script, and I'm seeing the error that was showing up before you introduced patch assetgraph/assetgraph@5402b9e

Here's the error:
file:///root/whim/web/public/user.js: Error: ENOENT, open '/root/whim/web/public/user.js

from assetgraph-builder.

mreinstein avatar mreinstein commented on September 26, 2024

I think I found the problem. did someone publish an old version to npm and mark it as the newest? when I run npm install assetgraph-builder it attempts to install version 1.2.2. but I have 1.4.0 installed on another server. I think this needs to be fixed in the npm registry.

from assetgraph-builder.

Munter avatar Munter commented on September 26, 2024

This is how npm works. Never depend on "latest", since that means the chronologically latest upload to npm, no matter the version.
It's pretty standard practice to have legacy branches with back ported patches, so you are going to run into this in lots of places.

The solution is to depend on ~1.4.x, though I recommend being very specific about the version at the moment, since each minor version also contains improvements. I recommend "=1.4.0" and keep updating it when you see interesting stuff coming in.

from assetgraph-builder.

papandreou avatar papandreou commented on September 26, 2024

Ah, right. I have some projects still running on assetgraph-builder 1.2.x and had to backport a fix, so I published 1.2.2 as a "maintenance release" from the 1.2 branch a couple of days ago.

For some odd reason, npm install <packageName> means npm install <packageName>@latest, which again means "install the version that was published most recently" not "install the highest version number".

I've read up on it a little and added "tag": <branchName> to the legacy branches. According to https://npmjs.org/doc/config.html that means it won't update the latest tag when new versions are published from those branches. I've also used the npm tag command to update the latest tag of assetgraph-builder to point at 1.4.0.

from assetgraph-builder.

Munter avatar Munter commented on September 26, 2024

I didn't know about that configuration. It seems many other authors don't either. Thanks for notifying.

from assetgraph-builder.

papandreou avatar papandreou commented on September 26, 2024

Closing. I believe the original issue has been fixed -- along with the others that were raised during the discussion.

from assetgraph-builder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.