typescript-ruby / typescript-rails

An asset pipeline wrapper for the TypeScript language
MIT License
255 stars 29 forks source link

Wildcard asset notation no longer works? #45

Open Vernadsky opened 8 years ago

Vernadsky commented 8 years ago

I've just upgraded to the latest version of typescript-rails, and now I get the following error:

Sprockets::Rails::Helper::AssetNotPrecompiled at / Asset was not declared to be precompiled in production. Add Rails.application.config.assets.precompile += %w( dashboard.js ) to config/initializers/assets.rb and restart your server

It works if I specify dashboard.jsdirectly in assets.rb (the file is actually dashboard.ts). But normally wildcards work fine:

Rails.application.config.assets.precompile += %w(lib/*.js *.js)

I've tried variations with .ts instead of .js. Did one of the commits break wildcard support?

bdrazhzhov commented 8 years ago

Hello @Vernadsky,

Could you check it with other versions of this gem and specify version which works well with your assets? Please specify versions which cannot process your assets correctly.

Vernadsky commented 8 years ago

Hi @bdrazhzhov,

Version 0.6.2.2 works fine (I've tried that version by manually specifying the 'v0.6.2.2' tag in my gemfile), the problem was introduced in 0.6.2.3. I suspect commit https://github.com/typescript-ruby/typescript-rails/commit/0965b68f8845143f37b53c51f4a2c5085fa3df80 breaks it.

mihai-dinculescu commented 8 years ago

Can you please try

gem 'typescript-rails', github: 'mihai-dinculescu/typescript-rails'
Vernadsky commented 8 years ago

Hi @mihai-dinculescu,

Unfortunately that version doesn't work either. Thanks for looking into this guys.

mihai-dinculescu commented 8 years ago

Do you have a reason for not using the already included by default path lib/assets/javascripts?

Alternatively you can try add your custom path like this:

Rails.application.config.assets.paths << Rails.root.join('angular')

I'm no expert in the asset pipeline but to my knowledge you put the custom paths in Rails.application.config.assets.paths. I do not think that Rails.application.config.assets.precompile is able to load files outside the defined paths.

Vernadsky commented 8 years ago

I've moved the app/assets/javascripts/lib files lib/assets/javascripts, but that doesn't solve the issue. Wildcards still don't work (neither versions).

yvbeek commented 8 years ago

I'm having the same issue. Any idea guys?

mihai-dinculescu commented 8 years ago

@Zyphrax and/or @Vernadsky, please provide replication steps, or even better, a test project.

yvbeek commented 8 years ago

I've noticed that this error only occurs when I use the .ts extension, it all works fine if I name my files .js.ts.