Giter VIP home page Giter VIP logo

Comments (11)

rossta avatar rossta commented on May 27, 2024

What version of Webpacker and Rails?

What is your JS directory structure?

from webpacker.

karimelghazouly avatar karimelghazouly commented on May 27, 2024

webpacker (4.3.0)
rails (6.0.3.5)

app/javascript
    react-configs/
    main_react_apps/

webpacker.yaml

source_path: app/javascript
source_entry_path: packs
public_root_path: public
public_output_path: assets
cache_path: tmp/cache/webpacker

inside packs we have this piece of code

import xxxconfig from '../react-configs/xxxconfig';
ReactOnRails.register({
    ...xxxconfig,
});

xxxconfig.js

const lessons = {
    "main_react_apps_1": require('main_react_apps/smthing/smthing/smthing/smthng').default,
    "main_react_apps_2": require('main_react_apps/smthing/smthing/smthing/smthng').default,
    ...
    ..
  }

Is that clear ?
@rossta

from webpacker.

ahmedAdel202090 avatar ahmedAdel202090 commented on May 27, 2024

+1 Same Problem

from webpacker.

rossta avatar rossta commented on May 27, 2024

Hard to say what’s going on with limited info.
If your build is taking 1.5hrs then some is either wrong or ill-matched with the setup or you have have thousands of source files (do you?)

Generally for slow builds, I’d add the following:

One suggestion is to upgrade Webpacker as it does look like you’re behind a few versions with v6 about to release.

You didn’t show what’s in your packs directory but if you have many files in there, that will definitely cause a slow build.

This article provides some debugging tips including how to use the speed-measure-webpack-plugin to identify a slow step—could be that disabling certain plugins in development could help with the local dev ex.

from webpacker.

karimelghazouly avatar karimelghazouly commented on May 27, 2024

@rossta
Our packs folder has 5 js files, I included in my last comment the main file that has include most of the files.
I tried upgrading my webpacker before and didn't work.
and yes we have huge amount of assets, I would say maybe almost a thousand.

My main question is about how caching work, does it check if all assets are the same or it checks only modified/deleted/new files ?
as far as I see it only checks if the all the files are the same it skips compile step, but if only one file is edited or added it re compiles everything.

from webpacker.

justin808 avatar justin808 commented on May 27, 2024

@karimelghazouly, first, can you try updating to the latest RC release?

Next, is your issue only with production or development as well.

You should be using hot-reloading with webpack for development work, per this example: https://github.com/shakacode/react_on_rails_tutorial_with_ssr_and_hmr_fast_refresh.

For production, very old versions of webpack and Node would clearly hurt.

My main question is about how caching work, does it check if all assets are the same or it checks only modified/deleted/new files ?

Caching? There is none. You're probably referring to the saved digest value that determines if recompilation should run during development. In general, don't use that as it's crazy slow. Use the webpack-dev-server or webpack --watch.

from webpacker.

justin808 avatar justin808 commented on May 27, 2024

Please open this as a discussion here: https://discuss.rubyonrails.org/c/webpacker/10

from webpacker.

justin808 avatar justin808 commented on May 27, 2024

We're saving issues for bug reports and features.

from webpacker.

karimelghazouly avatar karimelghazouly commented on May 27, 2024

@justin808 we are using hot reloading for development, my main issue is in production where we need a precompilation.
I think webpack support such behavior using caching as mentioned here
https://webpack.js.org/configuration/cache/

webpack-dev-server or webpack --watch is for development only

from webpacker.

karimelghazouly avatar karimelghazouly commented on May 27, 2024

@justin808 I believe this is an issue, as this behavior is not really efficient, recompilation of everything is a total waste of resources.

from webpacker.

justin808 avatar justin808 commented on May 27, 2024

We have caching turned on. Once you identify this issue still occurs in using the current RC version, I'll reopen the issue.

from webpacker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.