Skip to content

Commit 322681c

Browse files
committed
More descriptive error
1 parent a955263 commit 322681c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: packages/react-dev-utils/ModuleScopePlugin.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
'use strict';
1111

12+
const chalk = require('chalk');
1213
const path = require('path');
1314

1415
class ModuleScopePlugin {
@@ -51,7 +52,9 @@ class ModuleScopePlugin {
5152
if (requestRelative[0] === '.') {
5253
callback(
5354
new Error(
54-
`You attempted to require ${request.__innerRequest_request}, which falls outside of src/.`
55+
`You attempted to import ${chalk.cyan(request.__innerRequest_request)} which falls outside of the project ${chalk.cyan('src/')} directory. ` +
56+
`Relative imports outside of ${chalk.cyan('src/')} are not supported. ` +
57+
`You can either move it inside ${chalk.cyan('src/')}, or add a symlink to it from project's ${chalk.cyan('node_modules/')}.`
5558
),
5659
request
5760
);

0 commit comments

Comments
 (0)