Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions website/docs/en/guide/faq/exceptions.mdx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Exceptions FAQ

### Find ESNext code in the compiled files?
### Seeing ESNext code in the compiled files?

By default, Rsbuild does not compile JavaScript files under `node_modules`. If an npm package contains ESNext syntax, it will be bundled into the output.
By default, Rsbuild does not compile JavaScript files in `node_modules`. If an npm package includes ESNext syntax, that code is bundled as is.

To compile these files, use the [source.include](/config/source/include) configuration to specify additional directories or modules.

---

### Build error `Error: [object Object] is not a PostCSS plugin` ?
### Build error `Error: [object Object] is not a PostCSS plugin`?

Rsbuild uses PostCSS v8. If you encounter the `Error: [object Object] is not a PostCSS plugin` error during compilation, it's usually caused by using an incompatible version of PostCSS. For example, the `postcss` peer dependency version in `cssnano` may not match the expected version.
Rsbuild uses PostCSS v8. If you encounter this error during compilation, it's usually because a package is using an incompatible PostCSS version. For example, the `postcss` peer dependency version in `cssnano` may not match the expected version.

To find unmet peer dependencies, run `npm ls postcss`. Then fix the issue by specifying the correct PostCSS version in your package.json.

Expand All @@ -37,13 +37,13 @@ File was processed with these loaders:
You may need an additional loader to handle the result of these loaders.
```

Check whether you're referencing unsupported file formats, and configure the appropriate Rspack loader to handle them.
Check whether you're importing unsupported file formats, and configure the appropriate Rspack loader to handle them.

---

### Compilation error `export 'foo' (imported as 'foo') was not found in './utils'`?

This error means your code is importing an export that doesn't exist.
This error means your code is importing a symbol that doesn't exist.

For example, in the following code, `index.ts` is importing the `foo` variable from `utils.ts`, but `utils.ts` only exports the `bar` variable.

Expand Down Expand Up @@ -88,7 +88,7 @@ export { Foo } from './utils'; // Incorrect
export type { Foo } from './utils'; // Correct
```

In some cases, a third-party dependency you can't modify causes this error. If you're certain the issue doesn't affect your application, you can change the log level from `error` to `warn`:
In some cases, a third-party dependency you can't modify causes this error. If you're sure it doesn't affect your application, you can downgrade the log level from `error` to `warn`:

```ts title="rsbuild.config.ts"
export default {
Expand Down
20 changes: 10 additions & 10 deletions website/docs/en/guide/faq/features.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Features FAQ

### How to import UI component library on demand?
### How to import a UI component library on demand?

To configure the on-demand import of the component library, you can configure it through [source.transformImport](/config/source/transform-import), which is equivalent to [babel-plugin-import](https://npmjs.com/package/babel-plugin-import).
To enable on-demand imports for a component library, configure [source.transformImport](/config/source/transform-import). This works the same way as [babel-plugin-import](https://npmjs.com/package/babel-plugin-import).

```ts
export default {
Expand All @@ -22,13 +22,13 @@ export default {

### How to run ESLint during compilation?

For the sake of compilation performance, Rsbuild will not perform ESLint verification during the compilation process by default. If you require this feature, you can use Rsbuild's [ESLint plugin](https://github.com/rspack-contrib/rsbuild-plugin-eslint).
To protect compilation performance, Rsbuild doesn't run ESLint checks during builds by default. If you need ESLint in the pipeline, use the [ESLint plugin](https://github.com/rspack-contrib/rsbuild-plugin-eslint).

---

### How to configure CDN path for static assets?

To upload static assets such as JS and CSS to CDN for use, set the URL prefix of static assets through the [output.assetPrefix](/config/output/asset-prefix) configuration.
To serve static assets like JS and CSS from a CDN, set the asset URL prefix with [output.assetPrefix](/config/output/asset-prefix).

```js
export default {
Expand All @@ -42,17 +42,17 @@ export default {

### How to remove console after production build?

For the production build, we can remove the `console` from the code, so as to avoid the log of the development mode being output to the production.
In production builds, you can strip `console` calls to avoid shipping development logs.

Rsbuild provides a configuration option to remove console by default, please see [performance.removeConsole](/config/performance/remove-console).
Rsbuild provides a built-in option for removing console statements. See [performance.removeConsole](/config/performance/remove-console).

---

### How to view the final generated Rspack configuration?

By using the Rsbuild debug mode, you can view the Rspack configuration generated by Rsbuild.
Use Rsbuild's debug mode to view the Rspack configuration that Rsbuild generates.

You can enable the debug mode of Rsbuild by adding the `DEBUG=rsbuild` environment variable when performing the build. In this mode, the internally generated Rspack configuration will be outputted to the "dist" directory.
Enable debug mode by setting the `DEBUG=rsbuild` environment variable when running a build. In this mode, the generated Rspack configuration is written to the `dist` directory.

```bash
➜ DEBUG=rsbuild pnpm dev
Expand All @@ -73,9 +73,9 @@ config inspection completed, generated files:

### How to ignore specific warnings?

By default, Rsbuild will print all error and warning logs generated by the build process.
By default, Rsbuild prints all errors and warnings from the build.

If a large number of warning logs are generated by a third-party package and you want to ignore them, specific warning logs can be ignored through the `ignoreWarnings` configuration provided by Rspack.
If a noisy third-party package produces many warnings, you can silence specific messages with Rspack's `ignoreWarnings` configuration.

```ts
export default {
Expand Down
Loading