rails/webpacker

Webpacker 6 documentation discrepancy

SamShekhovtsov opened this issue · 3 comments

Hi community.

The documentation says:
Usage
Once installed, you can start writing modern ES6-flavored JavaScript apps right away:

app/javascript:
  # Only Webpack entry files here
  └── application.js
  └── application.css
  └── src:
  │   └── my_component.js
  └── stylesheets:
  │   └── my_styles.css
  └── images:
      └── logo.svg

however when I do rails webpacker:install , it automatically creates application.js file in the app/packs/entrypoints directory. Why it's not as the documentation states? Actual structure is following:

app/packs/entrypoints
     └── application.js

@guillaumebriday Do you know this is expected behavior?

I have also noticed if a pack file is under a subdirectory, it is no longer generating the pack file.

app/packs/ApplicationPack.js - generated
app/packs/foo/FooPack.js - skipped (behavior change in v5)

Is that a regression?

@kimyu92, that's the intended behavior. The packs list maps to webpack entry points. You should flatten out your packs to the top-level directory. The new behavior eliminates the problem of subdirectories creating tons of new, unnecessary entry points.

Here is the code change:

5de0fbc#diff-7af8667a3e36201db57c02b68dd8651883d7bfc00dc9653661be11cd31feeccdL19

I just updated the docs: See #3227.