mirror of
https://github.com/wassname/generator-react-webpack.git
synced 2026-09-11 12:10:36 +08:00
*ADD* Fallback: Added .jsx suffix support for new components (Resolves newtriks/generator-react-webpack#99)
This commit is contained in:
@@ -28,7 +28,7 @@ module.exports = {
|
||||
},
|
||||
|
||||
resolve: {
|
||||
extensions: ['', '.js'],
|
||||
extensions: ['', '.js', '.jsx'],
|
||||
alias: {
|
||||
'styles': __dirname + '/src/styles',
|
||||
'mixins': __dirname + '/src/mixins',
|
||||
@@ -39,12 +39,12 @@ module.exports = {
|
||||
},
|
||||
module: {
|
||||
preLoaders: [{
|
||||
test: /\.js$/,
|
||||
test: /\.(js|jsx)$/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'jsxhint'
|
||||
}],
|
||||
loaders: [{
|
||||
test: /\.js$/,
|
||||
test: /\.(js|jsx)$/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'react-hot!babel-loader'
|
||||
},<% if (stylesLanguage === 'sass') { %> {
|
||||
|
||||
@@ -13,7 +13,8 @@ module.exports = function (config) {
|
||||
'test/spec/actions/**/*.js'<% } %>
|
||||
],
|
||||
preprocessors: {
|
||||
'test/spec/components/**/*.js': ['webpack']<% if(architecture === 'flux'||architecture === 'reflux') { %>,
|
||||
'test/spec/components/**/*.js': ['webpack'],
|
||||
'test/spec/components/**/*.jsx': ['webpack']<% if(architecture === 'flux'||architecture === 'reflux') { %>,
|
||||
'test/spec/stores/**/*.js': ['webpack'],
|
||||
'test/spec/actions/**/*.js': ['webpack']<% } %>
|
||||
},
|
||||
@@ -30,7 +31,7 @@ module.exports = function (config) {
|
||||
test: /\.png/,
|
||||
loader: 'url-loader?limit=10000&mimetype=image/png'
|
||||
}, {
|
||||
test: /\.js$/,
|
||||
test: /\.(js|jsx)$/,
|
||||
loader: 'babel-loader'
|
||||
},<% if (stylesLanguage === 'sass') { %> {
|
||||
test: /\.sass/,
|
||||
|
||||
@@ -23,7 +23,7 @@ var <%= classedName %> = React.createClass({<% if(rich){%>
|
||||
|
||||
render: function () {
|
||||
return (
|
||||
<div>
|
||||
<div className="<%= classedName %>">
|
||||
<p>Content for <%= classedName %></p>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -5,7 +5,7 @@ describe('<%= classedName %>', function () {
|
||||
var <%= classedName %>, component;
|
||||
|
||||
beforeEach(function () {
|
||||
<%= classedName %> = require('components/<%= classedFileName %>.js');
|
||||
<%= classedName %> = require('components/<%= classedFileName %><%= reactComponentSuffix %>');
|
||||
component = React.createElement(<%= classedName %>);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user