Skip to content
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

Show compiling log in runtime #1970

Closed
pustovalov opened this issue Mar 1, 2019 · 8 comments
Closed

Show compiling log in runtime #1970

pustovalov opened this issue Mar 1, 2019 · 8 comments

Comments

@pustovalov
Copy link
Contributor

pustovalov commented Mar 1, 2019

Can I somehow modify this method https://github.com/rails/webpacker/blame/3-x-stable/lib/webpacker/compiler.rb#L63 to see the real-time log?

Right now I have trouble when webpacker compiling assets on ci and then show this error:

Using /home/circleci/main/config/webpacker.yml file for setting up webpack paths
Compiling…
Compilation failed:


Exited with code 1

If I run this command with simple-progress-webpack-plugin

NODE_ENV=test ./bin/webpack --config config/webpack/test.js

I see the real-time log and don't get an error

What I did to prevent this an error:
added NODE_OPTIONS: --max-old-space-size=3072

but it did not help

@david-crespo
Copy link

You can set webpack_compile_output: true in the config YAML to include the full webpack output in the Rails log.

@pustovalov
Copy link
Contributor Author

webpack_compile_output: true didn't help

[~/main]$ bundle exec rake assets:precompile                                                                                                         
yarn install v1.17.3
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
success Already up-to-date.
✨  Done in 0.96s.
Compiling…

@david-crespo
Copy link

Weird. Make sure you have it set for the correct environment and you're not overriding it elsewhere.

@khier996
Copy link

@pustovalov have u resolved your issue? from your last comment it seems that webpacker is stuck at "compile..." step. I have this problem on circleci now. increased the timeout to 35 minutes and it still hangs and times out after 35 minutes

@pustovalov
Copy link
Contributor Author

pustovalov commented Oct 24, 2019

@khier996 I solved this problem in a different way

config/webpack/test.js

const SimpleProgressWebpackPlugin = require('simple-progress-webpack-plugin')
environment.plugins.prepend(
  'SimpleProgressWebpackPlugin',
  new SimpleProgressWebpackPlugin({
    format: 'verbose',
  }),
)

config.yml

aliases:
  - &main_container
    environment:
      NODE_ENV: test
      RACK_ENV: test
      RAILS_ENV: test
      WEBPACKER_PRECOMPILE: false

jobs:
  prepare:
    <<: *docker_full
    steps:
      - *restore_assets
      - *restore_assets_cache
      - run:
          name: Precompile Assets
          command: |
            bin/webpack --config "config/webpack/$NODE_ENV.js"
            bundle exec rake assets:precompile
      - save_cache:
          key: *assets_cache_key
          paths:
            - public/assets
            - public/packs-test
            - tmp/cache/assets/sprockets
            - tmp/tkbl_assets

result:

[12:23:18] Webpack (10%) - Build modules ()
[12:23:18] Webpack (10%) - Build modules (/home/circleci/app/node_modules/babel-loader/lib/index.js??ref--13-0!/home/circleci/app/app/javascript/packs/lite/lite.js)
[12:23:18] Webpack (10%) - Build modules (/home/circleci/app/node_modules/babel-loader/lib/index.js??ref--13-0!/home/circleci/app/app/javascript/packs/application.js)
[12:23:18] Webpack (10%) - Build modules (/home/circleci/app/node_modules/babel-loader/lib/index.js??ref--13-0!/home/circleci/app/app/javascript/packs/auth.js)
[12:23:18] Webpack (10%) - Build modules (/home/circleci/app/node_modules/babel-loader/lib/index.js??ref--13-0!/home/circleci/app/app/javascript/packs/bundle_ab_tests.js)
[12:23:18] Webpack (10%) - Build modules (/home/circleci/app/node_modules/babel-loader/lib/index.js??ref--13-0!/home/circleci/app/app/javascript/packs/browser_lock.js)

@pustovalov
Copy link
Contributor Author

pustovalov commented Oct 24, 2019

also you can try to do this one:

NODE_OPTIONS: --max-old-space-size=3400

because circleci show you this information:

but in fact you have a different amount of RAM available to you

Hint: Exit code 137 typically means the process is killed because it was running out of memory
Hint: Check if you can optimize the memory usage in your app
Hint: Max memory usage of this container is 3681169408

@khier996
Copy link

@pustovalov thanks for help! I figured my problem had to do with erb-loader. I found the solution in this comment

I have a different problem now. Elasticsearch container exits with code 137. This did not happen before we started using webpacker. I know this is not relevant to the original issue, but if you know how to solve, pls let me know, i'll pm you.

@guillaumebriday
Copy link
Member

Can this issue be closed ?

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

5 participants