@@ -23,6 +23,8 @@ var paths = require('./paths');
23
23
var path = require ( 'path' ) ;
24
24
// @remove -on-eject-end
25
25
26
+ var ComponentResolverPlugin = require ( 'component-resolver-webpack' ) ;
27
+
26
28
// Webpack uses `publicPath` to determine where the app is being served from.
27
29
// In development, we always serve from the root. This makes config easier.
28
30
var publicPath = '/' ;
@@ -88,6 +90,7 @@ module.exports = {
88
90
// https://github.com/facebookincubator/create-react-app/issues/290
89
91
extensions : [ '.js' , '.json' , '.jsx' , '' ] ,
90
92
alias : {
93
+ '~' : paths . appSrc ,
91
94
// Support React Native Web
92
95
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
93
96
'react-native' : 'react-native-web'
@@ -147,8 +150,8 @@ module.exports = {
147
150
loader : 'babel' ,
148
151
query : {
149
152
// @remove -on-eject-begin
150
- babelrc : false ,
151
- presets : [ require . resolve ( 'babel-preset-react-app' ) ] ,
153
+ babelrc : true ,
154
+ presets : [ require . resolve ( 'babel-preset-react-app' ) , require . resolve ( './babel-preset-custom' ) ] ,
152
155
// @remove -on-eject-end
153
156
// This is a feature of `babel-loader` for webpack (not Babel itself).
154
157
// It enables caching results in ./node_modules/.cache/babel-loader/
@@ -185,7 +188,7 @@ module.exports = {
185
188
// Point ESLint to our predefined config.
186
189
eslint : {
187
190
configFile : path . join ( __dirname , '../.eslintrc' ) ,
188
- useEslintrc : false
191
+ useEslintrc : true
189
192
} ,
190
193
// @remove -on-eject-end
191
194
// We use PostCSS for autoprefixing only.
@@ -202,6 +205,11 @@ module.exports = {
202
205
] ;
203
206
} ,
204
207
plugins : [
208
+ // Allows us to resolve files without duplicating filename
209
+ // like "./Button"" could be resolved to "./Button/Button.js""
210
+ new webpack . ResolverPlugin ( [
211
+ new ComponentResolverPlugin ( [ 'jsx' , 'js' , 'css' ] )
212
+ ] ) ,
205
213
// Makes the public URL available as %PUBLIC_URL% in index.html, e.g.:
206
214
// <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
207
215
// In development, this will be an empty string.
0 commit comments