Socket
Book a DemoInstallSign in
Socket

rsbuild-plugin-legacy-deps-compat

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rsbuild-plugin-legacy-deps-compat

rsbuild is supported in projects that use webpack@<=4 and postcss<=7

latest
Source
npmnpm
Version
0.1.7
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

rsbuild-plugin-legacy-deps-compat

English | 简体中文

Suppose you have an old project that uses webpack@4.x and postcss@7.x, and you want to use rsbuild to improve efficiency for development and building while also retaining the original build method. You might encounter errors at this point, and this plugin attempts to solve this problem, currently supporting solutions for webpack and postcss related errors.

Quick start

  • Installation dependencies
npm i rsbuild-plugin-legacy-deps-compat -D
  • Configure rsbuild
import { defineConfig } from '@rsbuild/core'
import legacyDepsCompat from 'rsbuild-plugin-legacy-deps-compat'

export default defineConfig({
  plugins: [
    // Any version of webpack and postcss@7.x is used in the project.
    legacyDepsCompat(),

    // Any version of webpack and postcss@<7 is used in the project, but want to use postcss@8 in rsbuild.
    legacyDepsCompat({
      postcss: {
        // Place the postcss.config.js file in the "compat" directory.
        configDir: 'compat',
      },
    }),

    // Any version of webpack and want to use custom postcss-loader.
    legacyDepsCompat({
      postcss: {
        customPostcssLoaderOptions: {
          // Fill in the configuration of postcss-loader here.
        },
      },
    }),
  ]
})

Configuration

NameTypeDefaultDescription
webpackbooleantrueWhether to set an alias for webpack
postcssfalse|object{}postcss related configuration, set to false for no changes
postcss.clearBuiltinPluginsbooleantrueWhether to clear built-in postcss plugins
postcss.configDirstring./The directory where the postcss configuration file is located
postcss.customPostcssLoaderOptionsanyundefinedpostcss-loader options, setting this will use a custom postcss-loader. Make sure you have installed postcss-loader
postcss.addEmptyLoaderbooleanfalseWhether to add an empty-loader before postcss-loader

Encountered Component Library Style Issues with Custom postcss-loader

module.exports = ":root{--van-swipe-indicator-size:0.12rem;}"

If the styles of a component library (such as vant) become as shown above, although the specific cause is not known, it has been found through testing that adding an empty loader before the postcss-loader can resolve the issue. This is already built into the configuration

export default defineConfig({
  plugins: [
    legacyDepsCompat({
      customPostcssLoaderOptions: {},
      addEmptyLoader: true,
    }),
  ],
});

Keywords

rsbuild

FAQs

Package last updated on 24 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts