Skip to content

Commit b11812a

Browse files
committed
Merged ViXP into update-react-15
2 parents 5db749b + cbf3cd0 commit b11812a

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

lib/generators/react/component_generator.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,7 @@ def file_header
137137

138138
def file_footer
139139
if webpacker?
140-
if options[:es6]
141-
%|export default #{component_name}|
142-
else
143-
%|module.exports = #{component_name}|
144-
end
140+
%|export default #{component_name}|
145141
else
146142
''
147143
end

lib/generators/templates/component.js.jsx.coffee

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class @<%= component_name %> extends React.Component
1+
<%= file_header %>class @<%= component_name %> extends React.Component
22
<% if attributes.size > 0 -%>
33
@propTypes =
44
<% attributes.each do |attribute| -%>
@@ -16,3 +16,4 @@ class @<%= component_name %> extends React.Component
1616
<% else -%>
1717
`<div />`
1818
<% end -%>
19+
<%= file_footer %>

test/generators/component_generator_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def filename
2222
assert_file filename do |contents|
2323
if WebpackerHelpers.available?
2424
assert_match /^import React from "react"/, contents
25-
assert_match /module\.exports = GeneratedComponent\n$/m, contents
25+
assert_match /export default GeneratedComponent\n$/m, contents
2626
end
2727
end
2828
end

0 commit comments

Comments
 (0)