MyGit

v0.3.7

web-infra-dev/rspack

版本发布时间: 2023-10-17 20:03:48

web-infra-dev/rspack最新发布版本:v0.3.13(2023-11-15 21:30:09)

Highlights

experiments.rspackFuture.newResolver

This feature enables the new resolver implementation provided by oxc, which is 5 times faster than the previous resolver implementation. The new resolver also supports tsconfig project references defined in tsconfig-paths-webpack-plugin, which handles the support of nested paths alias inside project references. To fully opt-in this feature, use the following configuration or see resolve.tsConfig for details.

module.exports = {
  resolve: {
    tsconfig: {
      configFile: path.resolve(__dirname, './tsconfig.json'),
      references: 'auto'
    },
  }
  experiments: {
    rspackFuture: {
      newResolver: true
    }
  }
}

styled-components support

This feature enables the builtin:swc-loader to provide compile-time support for styled-components. Now you can configure it through options.rspackExperiments.styledComponents.

/** @type {import('@rspack/core').Configuration}*/
module.exports = {
  module: {
    rules: [
      {
        test: /\.jsx?$/,
        loader: "builtin:swc-loader",
        options: {
          jsc: {
            parser: {
              syntax: "ecmascript",
              jsx: true
            }
          },
          rspackExperiments: {
            styledComponents: {
              displayName: true,
              ssr: true,
              fileName: true,
              meaninglessFileNames: ["index", "styles"],
              namespace: "rspack-test",
              topLevelImportPaths: [
                "@xstyled/styled-components",
                "@xstyled/styled-components/*"
              ],
              transpileTemplateLiterals: true,
              minify: true,
              pure: true,
              cssProps: true
            }
          }
        }
      }
    ]
  }
};

SWC's support for styled-components is essentially aligned with the official Babel plugin, so you can visit babel-plugin-styled-components for more information.

Vue2 css extract support

Finished support for experiments.css for Vue2, you can extract css with our custom vue-loader (@rspack/loader-vue2). First, add our custom vue-loader to package.json

{
  "devDependencies": {
    "vue": "2.7.14",
    "vue-loader": "npm:@rspack/loader-vue2@15.10.1-alpha.0"
  }
}

Then, enable vue-loader with experimentalInlineMatchResource just like how you did with Vue3:

const { VueLoaderPlugin } = require("vue-loader");
module.exports = {
  plugins: [new VueLoaderPlugin()],
  module: {
    rules: [
      {
        test: /\.vue$/,
        use: [
          {
            loader: "vue-loader",
            options: {
              // to extract css, you should enable this
              experimentalInlineMatchResource: true
            }
          }
        ]
      }
    ]
  },
  experiments: {
    css: true
  }
};

Check out the example for details.

Rspress 1.0

Rspress is a static site generator based on Rspack and mdx-rs. It is 5~10 times faster than Docusaurus/Nextra and supports lots of nice features out of the box, such as i18n, full-text search, component preview and etc. See detail in https://github.com/orgs/web-infra-dev/discussions/5

What's Changed

Exciting New Features 🎉

Bug Fixes 🐞

Other Changes

New Contributors

Full Changelog: https://github.com/web-infra-dev/rspack/compare/v0.3.6...v0.3.7

相关地址:原始地址 下载(tar) 下载(zip)

查看:2023-10-17发行的版本