Skip to content

Commit 4fe49ee

Browse files
committed
Update pack generator
1 parent d865de1 commit 4fe49ee

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
react_on_rails (14.1.1)
4+
react_on_rails (14.2.1)
55
addressable
66
connection_pool
77
execjs (~> 2.5)

lib/react_on_rails/packs_generator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def create_pack(file_path)
4747
def pack_file_contents(file_path)
4848
registered_component_name = component_name(file_path)
4949
<<~FILE_CONTENT
50-
import ReactOnRails from 'react-on-rails';
50+
import ReactOnRails from 'react-on-rails/client';
5151
import #{registered_component_name} from '#{relative_component_path_from_generated_pack(file_path)}';
5252
5353
ReactOnRails.register({#{registered_component_name}});

spec/dummy/spec/packs_generator_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ module ReactOnRails
195195
it "generated pack for ComponentWithClientOnly uses client file for pack" do
196196
pack_content = File.read(component_pack)
197197

198+
expect(pack_content).to include("react-on-rails/client")
198199
expect(pack_content).to include("#{component_name}.client.jsx")
199200
expect(pack_content).not_to include("#{component_name}.jsx")
200201
expect(pack_content).not_to include("#{component_name}.server.jsx")
@@ -203,6 +204,7 @@ module ReactOnRails
203204
it "generated server bundle do not have ComponentWithClientOnly registered" do
204205
generated_server_bundle_content = File.read(generated_server_bundle_file_path)
205206

207+
expect(generated_server_bundle_content).not_to include("react-on-rails/client")
206208
expect(generated_server_bundle_content).not_to include("#{component_name}.jsx")
207209
expect(generated_server_bundle_content).not_to include("#{component_name}.client.jsx")
208210
expect(generated_server_bundle_content).not_to include("#{component_name}.server.jsx")

0 commit comments

Comments
 (0)