Skip to content

Commit

Permalink
Fix range issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmckeb committed Apr 7, 2019
1 parent 0cad065 commit 53befcc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/react/src/server/cra-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function isReactScriptsInstalled(requiredVersion = '2.0.0') {
try {
// eslint-disable-next-line import/no-dynamic-require,global-require
const reactScriptsJson = require(path.join(getReactScriptsPath(), 'package.json'));
return !semver.lt(reactScriptsJson.version, requiredVersion);
return !semver.gtr(requiredVersion, reactScriptsJson.version);
} catch (e) {
return false;
}
Expand Down
4 changes: 4 additions & 0 deletions app/react/src/server/framework-preset-cra.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ export function webpackFinal(config, { configDir }) {
}

export function managerWebpack(config) {
if (!isReactScriptsInstalled()) {
return config;
}

return {
...config,
resolveLoader: {
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/generators/REACT_SCRIPTS/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default async npmOptions => {
packageJson.devDependencies['@storybook/addons'] = addonsVersion;

// When working with `create-react-app@>=2.0.0`, we know `babel-loader` is installed.
if (semver.lt(packageJson.dependencies['react-scripts'], '2.0.0')) {
if (semver.gtr('2.0.0', packageJson.dependencies['react-scripts'])) {
await installBabel(npmOptions, packageJson);
}

Expand Down

0 comments on commit 53befcc

Please sign in to comment.