Skip to content

Commit

Permalink
Fix json-inclusion and linked-modules features by adding a custom jso…
Browse files Browse the repository at this point in the history
…n-loader rule
  • Loading branch information
sebinsua committed Mar 24, 2020
1 parent c7e0070 commit 983b167
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
3 changes: 3 additions & 0 deletions packages/react-scripts/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,9 @@ module.exports = function(webpackEnv) {
name: 'static/media/[name].[hash:8].[ext]',
},
},
// Webpack 5 Change: For some reason the default json-loader wasn't being used.
// This might be due to the type property I had to add to the first `parser.requireEnsure` rule?
{ test: /\.json$/, loader: require.resolve('json-loader') },
// ** STOP ** Are you adding a new loader?
// Make sure to add the new loader(s) before the "file" loader.
],
Expand Down
20 changes: 10 additions & 10 deletions packages/react-scripts/fixtures/kitchensink/template/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,16 @@ class App extends Component {
this.setFeature(f.default)
);
break;
// case 'json-inclusion':
// import('./features/webpack/JsonInclusion').then(f =>
// this.setFeature(f.default)
// );
// break;
// case 'linked-modules':
// import('./features/webpack/LinkedModules').then(f =>
// this.setFeature(f.default)
// );
// break;
case 'json-inclusion':
import('./features/webpack/JsonInclusion').then(f =>
this.setFeature(f.default)
);
break;
case 'linked-modules':
import('./features/webpack/LinkedModules').then(f =>
this.setFeature(f.default)
);
break;
case 'no-ext-inclusion':
import('./features/webpack/NoExtInclusion').then(f =>
this.setFeature(f.default)
Expand Down
1 change: 1 addition & 0 deletions packages/react-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"jest-environment-jsdom-fourteen": "1.0.1",
"jest-resolve": "24.9.0",
"jest-watch-typeahead": "0.4.2",
"json-loader": "0.5.7",
"mini-css-extract-plugin": "0.9.0",
"optimize-css-assets-webpack-plugin": "5.0.3",
"path-browserify": "1.0.1",
Expand Down

0 comments on commit 983b167

Please sign in to comment.