Skip to content

fix AssetAliasUsed issue #257

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

Closed
rmosolgo opened this issue Jun 10, 2015 · 3 comments
Closed

fix AssetAliasUsed issue #257

rmosolgo opened this issue Jun 10, 2015 · 3 comments

Comments

@rmosolgo
Copy link

In react-rails, we add different paths to the asset pipeline based on the app's config. With Sprockets 2 + sprockets-rails 2.3.1, this causes AssetAliasUsed error.

Is this error actually a problem? If not, it would be nice to remove it (or fix the check so it isn't raised in this case) and ship 2.3.2. If it is a problem, what does it mean? Or how should I fix it?

See full conversation, here's my initial report copied from that thread:

react-rails setup

In react-rails, app config specifies either production or development, based on that, we add a path to app.config.assets.paths, roughly speaking:

# add directory to asset pipeline, 
# based on the app config
app.config.assets.paths << root_path.join('lib/assets/react-source/').join(directory).to_s

(full src)

We do this so that the app only needs //= react, then, each environment gets its version of React.js (the development version has nice error messages, the production version has none).

error

However, we get an AssetAliasUsed from the javascript_include_tag helper:

image

Sure enough, these don't match:

image

Interestingly, if I upgrade to Sprockets 3 + sprockets-rails 2.3.1, I don't get this error (which is fine for me, but not fine for many other react-rails users...).

Is this the expected outcome? Are we misusing the asset pipeline? Anything else I can do to diagnose or address this?

We're really hoping to support an API where //= require react can provide different versions of the file based on environment configs. Previously we copied JS files into local directories, but that had its own issues!

Thanks!

@cseydel
Copy link

cseydel commented Jun 23, 2015

I can confirm this: Interestingly, if I upgrade to Sprockets 3 + sprockets-rails 2.3.1, I don't get this error

@rafaelfranca
Copy link
Member

This should be fixed on sprockets-rails 2.3.2. Please give it a try

@aprescott
Copy link

@rafaelfranca thank you!

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

4 participants