Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add rsdoctor example #19

Merged
merged 2 commits into from
Feb 2, 2024
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
1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ packages:
- "rsbuild/*"
- "rspress/*"
- "modernjs/*"
- "rsdoctor/*"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"private": true,
"scripts": {
"dev": "rspack serve",
"doctor": "RSDOCTOR=true rspack serve",
"build": "rspack build",
"analyze": "pnpm run build --analyze",
"preview": "cd dist && serve -s",
Expand Down Expand Up @@ -53,7 +54,8 @@
"react-refresh": "^0.14.0",
"serve": "14.1.2",
"style-loader": "^3.3.1",
"swc-loader": "^0.2.3"
"swc-loader": "^0.2.3",
"@rsdoctor/rspack-plugin": "0.1.0"
},
"browserslist": {
"production": [
Expand All @@ -73,4 +75,4 @@
}
},
"rspack": {}
}
}
File renamed without changes.
129 changes: 129 additions & 0 deletions rsdoctor/arco-pro/rspack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
const path = require("path");
const rspack = require("@rspack/core");
const { RsdoctorRspackPlugin } = require("@rsdoctor/rspack-plugin");
const ReactRefreshPlugin = require("@rspack/plugin-react-refresh");
const { default: HtmlPlugin } = require("@rspack/plugin-html");

const prod = process.env.NODE_ENV === "production";

/** @type {import('@rspack/cli').Configuration} */
const config = {
context: __dirname,
entry: "./src/index.tsx",
target: ["web", "es5"],
devtool: false,
devServer: {
port: 5555,
webSocketServer: "sockjs",
historyApiFallback: true,
},
module: {
rules: [
{
test: /\.less$/,
use: "less-loader",
type: "css",
},
{
test: /\.module\.less$/,
use: "less-loader",
type: "css/module",
},
{
test: /\.svg$/,
use: "@svgr/webpack",
},
{
test: /\.(j|t)s$/,
exclude: [/[\\/]node_modules[\\/]/],
use: {
loader: "builtin:swc-loader",
options: {
sourceMap: false,
jsc: {
parser: {
syntax: "typescript",
},
externalHelpers: true,
},
env: {
targets: "Chrome >= 48",
},
},
}
},
{
test: /\.(j|t)sx$/,
exclude: [/[\\/]node_modules[\\/]/],
use: {
loader: "builtin:swc-loader",
options: {
sourceMap: false,
jsc: {
parser: {
syntax: "typescript",
tsx: true,
},
transform: {
react: {
runtime: "automatic",
development: !prod,
refresh: !prod,
},
},
externalHelpers: true,
},
env: {
targets: "Chrome >= 48",
},
},
}
},
{
test: /\.png$/,
type: "asset",
},
],
},
resolve: {
alias: {
"@": path.resolve(__dirname, "src"),
// The default exported mock.js contains a minified [parser](https://github.com/nuysoft/Mock/blob/refactoring/src/mock/regexp/parser.js) with super deep binary
// expression, which causes stack overflow for swc parser in debug mode.
// Alias to the unminified version mitigates this problem.
// See also <https://github.com/search?q=repo%3Aswc-project%2Fswc+parser+stack+overflow&type=issues>
mockjs: require.resolve("./patches/mock.js"),
},
extensions: ["...", ".ts", ".tsx", ".jsx"],
},
output: {
publicPath: "/",
filename: "[name].[contenthash].js",
},
optimization: {
minimize: false, // Disabling minification because it takes too long on CI
realContentHash: true,
splitChunks: {
cacheGroups: {
someVendor: {
chunks: "all",
minChunks: 2,
},
},
},
},
plugins: [
new HtmlPlugin({
title: "Arco Pro App",
template: path.join(__dirname, "index.html"),
favicon: path.join(__dirname, "public", "favicon.ico"),
}),
new ReactRefreshPlugin(),
new rspack.ProgressPlugin(),
process.env.RSDOCTOR && new RsdoctorRspackPlugin(),
],
infrastructureLogging: {
debug: false,
},
};
module.exports = config;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
123 changes: 0 additions & 123 deletions rspack/arco-pro/rspack.config.js

This file was deleted.

Loading