新手问题 Rails 5.1 使用了 webpacker 之后怎么跑 ,production 模式需要额外跑什么服务吗

ad583255925 · August 25, 2017 · Last by robot_zhang replied at August 26, 2017 · 1637 hits

跑了 assets:precompile,但是资源加载不到

部署的时候 执行 rake assets:precompile 的时候应该也会执行 webpcker 的 compile 的。

会后我写篇文章讲怎么彻底抛弃 assets pipeline~

唉,你没有科学上网吗? 关键字 rails5.1 webpack precompile 我觉得应该是能解决的,你觉得呢?

assets:precompile 之后 webpack 也会编译的(如果使用了 capistrano3 那更是顺滑),但是引用 webpack 的资源要用下面的方式:

stylesheet_pack_tag 'xxx'
javascript_pack_tag 'xxx'

如果使用 webpack 最好尽可能使用 webpack 管理 js & css,混用之前的 assets 坑挺多的。

You need to Sign in before reply, if you don't have an account, please Sign up first.