Skip to content
This repository was archived by the owner on Apr 24, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This script is inspired by other work related such as: https://gist.github.com/j

## Ejection

This tool handles ejected projects but it assumes you did not modify your `webpack.config.dev.js` file, `paths.js` and `env.js` utils. If you did I cannot guarantee that this tool will work.
This tool handles ejected projects but it assumes you did not modify your `webpack.config.js` file, `paths.js` and `env.js` utils. If you did I cannot guarantee that this tool will work.

# Why do I need this?

Expand Down
4 changes: 2 additions & 2 deletions scripts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const { getReactScriptsVersion, isEjected } = require('../utils');
const paths = isEjected ? importCwd('./config/paths') : importCwd('react-scripts/config/paths');
const webpack = importCwd('webpack');
const config = isEjected
? importCwd('./config/webpack.config.dev')
: importCwd('react-scripts/config/webpack.config.dev');
? importCwd('./config/webpack.config')('development')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid it will be a bit more complicated than that. If we do that, we break the backward compatibility with react-scripts previous version. You need to use the react-scripts version that are available to you higher up:

const { getReactScriptsVersion, isEjected } = require('../utils');
to use the previous webpack.config file path or your new version. To see an example of how it is used:
if (major >= 2) {

We also need to check that the array indexes have not changed and remain the same in the second line of code I linked.

: importCwd('react-scripts/config/webpack.config')('development');
const HtmlWebpackPlugin = importCwd('html-webpack-plugin');
const InterpolateHtmlPlugin = importCwd('react-dev-utils/InterpolateHtmlPlugin');
const getClientEnvironment = isEjected
Expand Down
2 changes: 1 addition & 1 deletion utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const DEFAULT_VERSION = {
patch: 4,
};

exports.isEjected = fs.pathExistsSync(path.join(process.cwd(), 'config/webpack.config.dev.js'));
exports.isEjected = fs.pathExistsSync(path.join(process.cwd(), 'config/webpack.config.js'));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing here than above.


exports.getReactScriptsVersion = function getReactScriptsVersion(cliVersion) {
if (cliVersion) {
Expand Down