File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -1097,10 +1097,21 @@ define(function (require) {
1097
1097
' for optimization, and "dir" if you want the appDir' +
1098
1098
' or baseUrl directories optimized.' ) ;
1099
1099
}
1100
- if ( config . dir && config . appDir && config . dir === config . appDir ) {
1101
- throw new Error ( '"dir" and "appDir" set to the same directory.' +
1102
- ' This could result in the deletion of appDir.' +
1103
- ' Stopping.' ) ;
1100
+
1101
+ if ( config . dir ) {
1102
+ // Make sure the output dir is not set to a parent of the
1103
+ // source dir or the same dir, as it will result in source
1104
+ // code deletion.
1105
+ if ( config . dir === config . baseUrl ||
1106
+ config . dir === config . appDir ||
1107
+ ( config . baseUrl && build . makeRelativeFilePath ( config . dir ,
1108
+ config . baseUrl ) . indexOf ( '..' ) !== 0 ) ||
1109
+ ( config . appDir &&
1110
+ build . makeRelativeFilePath ( config . dir , config . appDir ) . indexOf ( '..' ) !== 0 ) ) {
1111
+ throw new Error ( '"dir" is set to a parent or same directory as' +
1112
+ ' "appDir" or "baseUrl". This can result in' +
1113
+ ' the deletion of source code. Stopping.' ) ;
1114
+ }
1104
1115
}
1105
1116
1106
1117
if ( config . insertRequire && ! lang . isArray ( config . insertRequire ) ) {
You can’t perform that action at this time.
0 commit comments