question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Compile locally for production?

See original GitHub issue

Hi I need to know how would I compile locally for production rather than at server, as my server resources can not afford the compilation process. I was looking at this issue at webpacker

I tried : bundle exec rails webpacker:compile , I got error:

Error: Command 'webpacker:compile' not recognized

but I am already have gem 'webpacker' in my Gemfile and its installed…

Can you please tell me how did you compile locally? I just need to locally compile the react project, not the whole assets.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
hopewisecommented, Mar 14, 2019

Okey, here is my deployment log:

..
..

Webpacker is installed 🎉 🍰
Using /var/www/myapp/releases/20190314152431/config/webpacker.yml file for setting up webpack paths
Compiling…
Compilation failed:

Hash: e6a13856e42943387cfc
Version: webpack 3.12.0
Time: 7113ms
                             Asset       Size  Chunks             Chunk Names
    devops-fabf6ca4219f54c425c5.js     162 kB       0  [emitted]  devops
devops-fabf6ca4219f54c425c5.js.map     202 kB       0  [emitted]  devops
                     manifest.json  122 bytes          [emitted]
                  manifest.json.gz   83 bytes          [emitted]
 devops-fabf6ca4219f54c425c5.js.gz    50.9 kB          [emitted]

so, it seems that it does compile however, here is my config/webpacker.yml:

default: &default
  source_path: app/javascript
  source_entry_path: packs
  public_output_path: packs
  cache_path: tmp/cache/webpacker

  # Additional paths webpack should lookup modules
  # ['app/assets', 'engine/foo/app/assets']
  resolved_paths: []

  # Reload manifest.json on all requests so we reload latest compiled packs
  cache_manifest: false

  extensions:
    - .jsx
    - .js
    - .sass
    - .scss
    - .css
    - .module.sass
    - .module.scss
    - .module.css
    - .png
    - .svg
    - .gif
    - .jpeg
    - .jpg

development:
  <<: *default
  compile: false

  # Reference: https://webpack.js.org/configuration/dev-server/
  dev_server:
    https: false
    host: localhost
    port: 3035
    public: localhost:3035
    hmr: false
    # Inline should be set to true if using HMR
    inline: true
    overlay: true
    compress: true
    disable_host_check: true
    use_local_ip: false
    quiet: false
    headers:
      'Access-Control-Allow-Origin': '*'
    watch_options:
      ignored: /node_modules/


test:
  <<: *default
  compile: false

  # Compile test packs to a separate directory
  public_output_path: packs-test

production:
  <<: *default

  # Production depends on precompilation of packs prior to booting for performance.
  compile: false

  # Cache manifest.json for performance
  cache_manifest: true

Any idea?

1reaction
hopewisecommented, Mar 13, 2019

I deploy via Capistrano… I will set compile: false to save server power…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Test react production build locally | by Samrat Shaw - Medium
In this article, we will look at three ways of testing your production build locally, namely: http-server; serve; Python web server (Mac only)....
Read more >
How to run production react app in local with local back-end
After running the command serve -s build you can access your production build at localhost (on the specified port).
Read more >
How to Run an Angular Production Build Locally
A tutorial that shows you how to serve your ng build --prod files locally without pushing the production files to your remote production...
Read more >
Build for production - Polymer Project
Your builds will be generated under the build folder, ready for deployment. You can also serve a build locally. For example, from your...
Read more >
Deployment | Create React App
npm run build creates a build directory with a production build of your app. Set up your favorite HTTP server so that a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found