Array<string | Regexp> | Function
undefined
only support webpack
Restrict importing paths. After configuring this option, all source files can only import code from the specific paths, and import code from other paths is not allowed.
First, we configure moduleScopes
to only include the src
directory:
Then we import the utils/a
module outside the src
directory in src/App.tsx
:
After compiling, there will be a reference path error:
If we configure the utils
directory in moduleScopes
, the error will disappear.
You can directly set several paths like this:
moduleScopes
also supports setting as a function, which can be modified instead of overriding the default value: