Comments (14)
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.
@papandreou cool that workaround fixed it. Thanks!
from assetgraph-builder.
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.
Yeah, that's a bug, fixed in assetgraph/assetgraph@5402b9e -- thanks :)
from assetgraph-builder.
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.
Sure, go for it!
from assetgraph-builder.
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.
@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.
@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.
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.
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.
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.
I didn't know about that configuration. It seems many other authors don't either. Thanks for notifying.
from assetgraph-builder.
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)
- Dedupe source maps HOT 1
- RSS feed link gets updated wrong
- When browsers list is not configured, look for it in package.json HOT 2
- Support .browserslistrc and browserslist key in package.json HOT 5
- Is it possible to wrap the built JS in a function to not expose define() ? HOT 4
- Throws when encountering Html Svg island with inline style HOT 1
- Generates invalid syntax from ES6 code HOT 4
- `node-zopfli` package seems no longer maintained HOT 5
- Ruby Sass is deprecated HOT 2
- Add `--preflight-check` cmdline option HOT 7
- `npm audit` complaints HOT 6
- Breaks await expression HOT 4
- Breaks relative ES6 module paths HOT 4
- ⚠ WARN: Cannot read property 'length' of null HOT 2
- [Q] CHANGELOG? HOT 4
- make assetgraph to not process svg HOT 2
- Translation not working HOT 1
- How to customize? HOT 3
- a vulnerability CVE-2020-7598 is introduced in assetgraph-builder
- Svgo is not a constructor HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from assetgraph-builder.