Heroku Ruby / Rails缓存Webpack +部署之间的纱线

时间:2017-12-21 19:50:22

标签: ruby-on-rails heroku

我目前使用webpacker设置了全新的ruby / rails应用程序。每次部署到Heroku都需要额外的30秒以重新安装纱线依赖项(运行yarn install)。

remote:        [1/4] Resolving packages...
remote:        [2/4] Fetching packages...
remote:        info fsevents@1.1.3: The platform "linux" is incompatible with this module.
remote:        info "fsevents@1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
remote:        [3/4] Linking dependencies...
remote:        warning "babel-loader@7.1.2" has incorrect peer dependency "babel-core@6 || 7 || ^7.0.0-alpha || ^7.0.0-beta || ^7.0.0-rc".
remote:        warning "babel-loader@7.1.2" has incorrect peer dependency "webpack@2 || 3".
remote:        warning "compression-webpack-plugin@1.1.2" has incorrect peer dependency "webpack@^2.0.0 || ^3.0.0".
remote:        warning "extract-text-webpack-plugin@3.0.2" has incorrect peer dependency "webpack@^3.1.0".
remote:        warning "file-loader@1.1.5" has incorrect peer dependency "webpack@^2.0.0 || ^3.0.0".
remote:        warning "postcss-cssnext@3.0.2" has incorrect peer dependency "caniuse-lite@^1.0.30000697".
remote:        warning "rails-erb-loader@5.2.1" has incorrect peer dependency "webpack@^2.0.0 || >= 3.0.0-rc.0 || ^3.0.0".
remote:        warning "sass-loader@6.0.6" has incorrect peer dependency "node-sass@^4.0.0".
remote:        warning "sass-loader@6.0.6" has incorrect peer dependency "webpack@^2.0.0 || >= 3.0.0-rc.0 || ^3.0.0".
remote:        warning "url-loader@0.6.2" has incorrect peer dependency "file-loader@*".
remote:        warning "webpack-manifest-plugin@1.3.2" has incorrect peer dependency "webpack@1 || 2 || 3".
remote:        warning "ajv-keywords@2.1.1" has incorrect peer dependency "ajv@^5.0.0".
remote:        warning "uglifyjs-webpack-plugin@0.4.6" has incorrect peer dependency "webpack@^1.9 || ^2 || ^2.1.0-beta || ^2.2.0-rc || ^3.0.0".
remote:        warning "babel-plugin-transform-vue-jsx@3.5.0" has incorrect peer dependency "babel-helper-vue-jsx-merge-props@^2.0.0".
remote:        warning "babel-plugin-transform-vue-jsx@3.5.0" has incorrect peer dependency "babel-plugin-syntax-jsx@^6.8.0".
remote:        warning "vue-loader@13.5.0" has incorrect peer dependency "css-loader@*".
remote:        warning "webpack-dev-server@2.9.7" has incorrect peer dependency "webpack@^2.2.0 || ^3.0.0".
remote:        warning "webpack-dev-middleware@1.12.2" has incorrect peer dependency "webpack@^1.0.0 || ^2.0.0 || ^3.0.0".
remote:        [4/4] Building fresh packages...
remote:        Done in 33.50s.
remote:        Webpacker is installed  

我目前在heroku/ruby堆栈上使用heroku-16 buildpack。 有什么简单的方法可以让缓存像Bundler一样工作吗?

1 个答案:

答案 0 :(得分:2)

除了你的heroku堆栈之外,你可以添加a second nodejs buildpack

heroku buildpacks:add --index 1 heroku/nodejs

nodejs buildpack应支持here所述的纱线缓存。