Open
Description
Rails 7 seems to be moving away from webpack(er), with multiple options to bundle JS with the new js-bundling
gem (e.g. with ESbuild etc.).
As such, in order to future proof the project, it might make sense to add support/documentation for JS bundling solutions other than webpack.
Notably, require.context()
is webpack specific. I have managed to work around this by providing a mapping manually with ESbuild:
var ReactRailsUJS = require('react_ujs');
ReactRailsUJS.useContext({
Table: require('./components/Table'),
});
As such, simply removing require.context()
meant that I was able to successfully use react-rails with ESbuild.
This took quite some time to work out - as such, it would be useful to document this (or a better solution) somewhere.
Metadata
Metadata
Assignees
Labels
No labels