string[]
['.ts', '.tsx', '.mjs', '.js', '.jsx', '.json']
>= 1.1.9
Automatically resolve file extensions when importing modules. This means you can import files without explicitly writing their extensions.
For example, if importing './index'
, Rsbuild will try to resolve using the following order
./index.ts
./index.tsx
./index.mjs
./index.js
./index.jsx
./index.json
It is not recommended to omit .vue
or other custom import extension names using resolve.extensions
, as this may interfere IDE and type support.
The value of resolve.extensions
overrides the default value of Rsbuild:
resolve.extensions
is provided by Rspack, see Rspack - resolve.extensions.
You can also configure it using tools.rspack:
The difference between them is how the configuration is merged.
tools.rspack
merges the configuration arrays based on webpack-merge, which means tools.rspack.resolve.extensions
will merge with the default value of Rsbuild, rather than overriding it.