Skip to content

react_on_rails:generate_packs should add the import statement to the entry point even if the packs already exist #1609

@alexeyr-ci

Description

@alexeyr-ci

A bug is a crash or incorrect behavior. If you have a debugging or troubleshooting question, please open a discussion.

Environment

  1. Ruby version: 3.3.0
  2. Rails version: 7.1.3.2
  3. Shakapacker/Webpacker version: 6.5.6
  4. React on Rails version: 13.4.0

Expected behavior

  1. Running bin/rake react_on_rails:generate_packs should always add the import like
// import statement added by react_on_rails:generate_packs rake task
import "./../generated/server-bundle-generated.js"

to the server_bundle_js_file if it's missing there.
2. On the other hand, if the import is present already, it shouldn't be added.
3. The comment could include suggestion to rerun the task if the generated file is missing.

Actual behavior

When the generated files already exist, the import isn't added.

Small, reproducible repo

  1. Run bin/rake react_on_rails:generate_packs in the dummy app. The import line is added.
  2. Run git reset --hard HEAD
  3. Run bin/rake react_on_rails:generate_packs again. The import line is not added.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions