Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yanhaijing/rspack-cra
create-react-app 迁移 rspack 示例
https://github.com/yanhaijing/rspack-cra
Last synced: 3 months ago
JSON representation
create-react-app 迁移 rspack 示例
- Host: GitHub
- URL: https://github.com/yanhaijing/rspack-cra
- Owner: yanhaijing
- Created: 2023-10-10T02:35:41.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-12-01T09:37:22.000Z (about 1 year ago)
- Last Synced: 2024-10-11T23:27:33.299Z (3 months ago)
- Language: JavaScript
- Size: 622 KB
- Stars: 10
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-rspack - rspack for create-react-app
README
# Create React App 迁移 rspack 示例
本示例使用 yarn 1.22.19 安装依赖。
使用 2023-10-19 号的 [email protected] 脚手架创建的项目,接入了[email protected],同时给 create-react-app 添加了测试环境的构建(build:test)。
## 你的项目如何接入 rspack
第 1 步,将模板里面的如下文件复制到你的项目中:
- config
- rspack.config.js第 2 步,修改 package.json 添加如下字段
```json
{
"scripts": {
"start": "rspack serve",
"build": "rspack build",
"build:test": "ENV=test rspack build"
},
"dependencies": {
"core-js": "3.30.1"
},
"devDependencies": {
"@rspack/cli": "^0.3.11",
"webpack-merge": "^5.10.0",
"eslint-rspack-plugin": "4.0.0-alpha",
"less": "4.1.3",
"less-loader": "7.3",
"postcss-loader": "6.2.1",
"resolve-url-loader": "4.0.0",
"sass-loader": "12.6.0"
}
}
```现在可以运行如下命令,进行验证:
```bash
yarn start
yarn build
```## 这个项目搭建步骤如下
```bash
$ npx [email protected] rspack-cra --template typescript
```## 迁移遇到的问题
https://github.com/web-infra-dev/rspack/issues/4295