create-rsbuild 0.0.0-nightly-20231027160925

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/LICENSE +21 -0
  3. package/README.md +19 -0
  4. package/dist/index.d.ts +2 -0
  5. package/dist/index.js +103 -0
  6. package/modern.config.ts +3 -0
  7. package/package.json +41 -0
  8. package/template-common/README.md +29 -0
  9. package/template-common/gitignore +13 -0
  10. package/template-react-js/package.json +18 -0
  11. package/template-react-js/rsbuild.config.mjs +9 -0
  12. package/template-react-js/src/App.jsx +22 -0
  13. package/template-react-js/src/index.css +41 -0
  14. package/template-react-js/src/index.html +10 -0
  15. package/template-react-js/src/index.jsx +11 -0
  16. package/template-react-ts/package.json +21 -0
  17. package/template-react-ts/rsbuild.config.ts +9 -0
  18. package/template-react-ts/src/App.tsx +22 -0
  19. package/template-react-ts/src/index.css +41 -0
  20. package/template-react-ts/src/index.html +10 -0
  21. package/template-react-ts/src/index.tsx +11 -0
  22. package/template-react-ts/tsconfig.json +14 -0
  23. package/template-vue2-js/package.json +17 -0
  24. package/template-vue2-js/rsbuild.config.mjs +9 -0
  25. package/template-vue2-js/src/App.vue +27 -0
  26. package/template-vue2-js/src/index.css +41 -0
  27. package/template-vue2-js/src/index.html +10 -0
  28. package/template-vue2-js/src/index.js +8 -0
  29. package/template-vue2-ts/package.json +18 -0
  30. package/template-vue2-ts/rsbuild.config.ts +9 -0
  31. package/template-vue2-ts/src/App.vue +29 -0
  32. package/template-vue2-ts/src/env.d.ts +5 -0
  33. package/template-vue2-ts/src/index.css +41 -0
  34. package/template-vue2-ts/src/index.html +10 -0
  35. package/template-vue2-ts/src/index.ts +8 -0
  36. package/template-vue2-ts/tsconfig.json +13 -0
  37. package/template-vue3-js/package.json +17 -0
  38. package/template-vue3-js/rsbuild.config.mjs +9 -0
  39. package/template-vue3-js/src/App.vue +29 -0
  40. package/template-vue3-js/src/index.css +41 -0
  41. package/template-vue3-js/src/index.html +10 -0
  42. package/template-vue3-js/src/index.js +5 -0
  43. package/template-vue3-ts/package.json +18 -0
  44. package/template-vue3-ts/rsbuild.config.ts +9 -0
  45. package/template-vue3-ts/src/App.vue +23 -0
  46. package/template-vue3-ts/src/env.d.ts +6 -0
  47. package/template-vue3-ts/src/index.css +41 -0
  48. package/template-vue3-ts/src/index.html +10 -0
  49. package/template-vue3-ts/src/index.ts +5 -0
  50. package/template-vue3-ts/tsconfig.json +13 -0
  51. package/tsconfig.json +8 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,14 @@
1
+ # create-rsbuild
2
+
3
+ ## 0.0.0-nightly-20231027160925
4
+
5
+ ### Patch Changes
6
+
7
+ - 3d261af: fix(create-rsbuild): failed to publish tsconfig of templates
8
+
9
+ ## 0.0.9
10
+
11
+ ### Patch Changes
12
+
13
+ - 0fbab50: fix(create-rsbuild): failed to resolve the templates
14
+ - e6be3a5: fix(create-rspack): skip local files for debugging
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023-present Bytedance, Inc. and its affiliates.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,19 @@
1
+ <p align="center">
2
+ <a href="https://rsbuild.dev" target="blank"><img src="https://github.com/web-infra-dev/rsbuild/assets/7237365/84abc13e-b620-468f-a90b-dbf28e7e9427" alt="Rsbuild Logo" /></a>
3
+ </p>
4
+
5
+ # Rsbuild
6
+
7
+ Unleash the power of Rspack with the out-of-the-box build tool.
8
+
9
+ ## Documentation
10
+
11
+ https://rsbuild.dev/
12
+
13
+ ## Contributing
14
+
15
+ Please read the [Contributing Guide](https://github.com/web-infra-dev/rsbuild/blob/main/CONTRIBUTING.md).
16
+
17
+ ## License
18
+
19
+ Rsbuild is [MIT licensed](https://github.com/web-infra-dev/rsbuild/blob/main/LICENSE).
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,103 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
+ // If the importer is in node compatibility mode or this is not an ESM
19
+ // file that has been converted to a CommonJS file using a Babel-
20
+ // compatible transform (i.e. "__esModule" has not been set), then set
21
+ // "default" to the CommonJS "module.exports" for node compatibility.
22
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
+ mod
24
+ ));
25
+ var import_fs = __toESM(require("fs"));
26
+ var import_path = __toESM(require("path"));
27
+ var import_rslog = require("rslog");
28
+ var import_prompts = require("@clack/prompts");
29
+ function checkCancel(value) {
30
+ if ((0, import_prompts.isCancel)(value)) {
31
+ (0, import_prompts.cancel)("Operation cancelled.");
32
+ process.exit(0);
33
+ }
34
+ }
35
+ function formatTargetDir(targetDir) {
36
+ return targetDir.trim().replace(/\/+$/g, "");
37
+ }
38
+ async function main() {
39
+ console.log("");
40
+ import_rslog.logger.greet("◆ Create Rsbuild Project");
41
+ const cwd = process.cwd();
42
+ const packageRoot = import_path.default.resolve(__dirname, "..");
43
+ let targetDir = await (0, import_prompts.text)({
44
+ message: "Input target folder",
45
+ placeholder: "my-project",
46
+ validate(value) {
47
+ if (value.length === 0) {
48
+ return `Target folder is required`;
49
+ }
50
+ if (import_fs.default.existsSync(import_path.default.join(cwd, value))) {
51
+ return `"${value}" is not empty, please input another folder`;
52
+ }
53
+ }
54
+ });
55
+ checkCancel(targetDir);
56
+ targetDir = formatTargetDir(targetDir);
57
+ const framework = await (0, import_prompts.select)({
58
+ message: "Select framework",
59
+ options: [
60
+ { value: "react", label: "React" },
61
+ { value: "vue3", label: "Vue 3" },
62
+ { value: "vue2", label: "Vue 2" }
63
+ ]
64
+ });
65
+ checkCancel(framework);
66
+ const language = await (0, import_prompts.select)({
67
+ message: "Select language",
68
+ options: [
69
+ { value: "ts", label: "TypeScript" },
70
+ { value: "js", label: "JavaScript" }
71
+ ]
72
+ });
73
+ checkCancel(language);
74
+ const srcFolder = import_path.default.join(packageRoot, `template-${framework}-${language}`);
75
+ const commonFolder = import_path.default.join(packageRoot, `template-common`);
76
+ const distFolder = import_path.default.join(cwd, targetDir);
77
+ copyFolder(commonFolder, distFolder);
78
+ copyFolder(srcFolder, distFolder);
79
+ const nextSteps = [`cd ${targetDir}`, "npm i", "npm dev"];
80
+ (0, import_prompts.note)(nextSteps.join("\n"), "Next steps");
81
+ (0, import_prompts.outro)("Done.");
82
+ }
83
+ function copyFolder(src, dist) {
84
+ const renameFiles = {
85
+ gitignore: ".gitignore"
86
+ };
87
+ const skipFiles = ["node_modules", "dist"];
88
+ import_fs.default.mkdirSync(dist, { recursive: true });
89
+ for (const file of import_fs.default.readdirSync(src)) {
90
+ if (skipFiles.includes(file)) {
91
+ continue;
92
+ }
93
+ const srcFile = import_path.default.resolve(src, file);
94
+ const distFile = renameFiles[file] ? import_path.default.resolve(dist, renameFiles[file]) : import_path.default.resolve(dist, file);
95
+ const stat = import_fs.default.statSync(srcFile);
96
+ if (stat.isDirectory()) {
97
+ copyFolder(srcFile, distFile);
98
+ } else {
99
+ import_fs.default.copyFileSync(srcFile, distFile);
100
+ }
101
+ }
102
+ }
103
+ main();
@@ -0,0 +1,3 @@
1
+ import baseConfig from '../../scripts/modern.base.config';
2
+
3
+ export default baseConfig;
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "create-rsbuild",
3
+ "description": "Create a new Rsbuild project",
4
+ "homepage": "https://rsbuild.dev",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/web-infra-dev/rsbuild",
8
+ "directory": "packages/create-rsbuild"
9
+ },
10
+ "license": "MIT",
11
+ "version": "0.0.0-nightly-20231027160925",
12
+ "types": "./dist/index.d.ts",
13
+ "main": "./dist/index.js",
14
+ "bin": {
15
+ "create-rsbuild": "./dist/index.js"
16
+ },
17
+ "exports": {
18
+ ".": {
19
+ "types": "./dist/index.d.ts",
20
+ "default": "./dist/index.js"
21
+ }
22
+ },
23
+ "dependencies": {
24
+ "@clack/prompts": "^0.7.0",
25
+ "rslog": "^1.1.0"
26
+ },
27
+ "devDependencies": {
28
+ "@types/node": "^16",
29
+ "typescript": "^5"
30
+ },
31
+ "publishConfig": {
32
+ "registry": "https://registry.npmjs.org/",
33
+ "access": "public",
34
+ "provenance": true
35
+ },
36
+ "scripts": {
37
+ "dev": "modern build --watch",
38
+ "build": "modern build",
39
+ "start": "node ./dist/index.js"
40
+ }
41
+ }
@@ -0,0 +1,29 @@
1
+ # Rsbuild Project
2
+
3
+ ## Setup
4
+
5
+ Install the dependencies:
6
+
7
+ ```bash
8
+ pnpm install
9
+ ```
10
+
11
+ ## Get Started
12
+
13
+ Start the dev server:
14
+
15
+ ```
16
+ pnpm dev
17
+ ```
18
+
19
+ Build the app for production:
20
+
21
+ ```
22
+ pnpm build
23
+ ```
24
+
25
+ Preview the production build locally:
26
+
27
+ ```
28
+ pnpm serve
29
+ ```
@@ -0,0 +1,13 @@
1
+ # Local
2
+ .DS_Store
3
+ *.local
4
+ *.log*
5
+
6
+ # Dist
7
+ node_modules
8
+ dist/
9
+
10
+ # IDE
11
+ .vscode/*
12
+ !.vscode/extensions.json
13
+ .idea
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "rsbuild-react-js",
3
+ "private": true,
4
+ "version": "1.0.0",
5
+ "scripts": {
6
+ "dev": "rsbuild dev",
7
+ "build": "rsbuild build",
8
+ "preview": "rsbuild preview"
9
+ },
10
+ "dependencies": {
11
+ "react": "^18",
12
+ "react-dom": "^18"
13
+ },
14
+ "devDependencies": {
15
+ "@rsbuild/core": "nightly",
16
+ "@rsbuild/plugin-react": "nightly"
17
+ }
18
+ }
@@ -0,0 +1,9 @@
1
+ import { defineConfig } from '@rsbuild/core';
2
+ import { pluginReact } from '@rsbuild/plugin-react';
3
+
4
+ export default defineConfig({
5
+ plugins: [pluginReact()],
6
+ html: {
7
+ template: './src/index.html',
8
+ },
9
+ });
@@ -0,0 +1,22 @@
1
+ import { useState } from 'react';
2
+
3
+ const HelloWorld = () => {
4
+ const [count, setCount] = useState(0);
5
+
6
+ return (
7
+ <div>
8
+ <h1>Rsbuild + React</h1>
9
+
10
+ <div>
11
+ <button type="button" onClick={() => setCount(count + 1)}>
12
+ count is {count}
13
+ </button>
14
+ <p>
15
+ Edit <code>App.tsx</code> to test HMR
16
+ </p>
17
+ </div>
18
+ </div>
19
+ );
20
+ };
21
+
22
+ export default HelloWorld;
@@ -0,0 +1,41 @@
1
+ :root {
2
+ font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
3
+ font-size: 16px;
4
+ line-height: 24px;
5
+ font-weight: 400;
6
+ color: #213547;
7
+ background-color: #ffffff;
8
+ max-width: 1280px;
9
+ margin: 0 auto;
10
+ padding: 5rem;
11
+ text-align: center;
12
+ }
13
+
14
+ body {
15
+ margin: 0;
16
+ min-height: 100vh;
17
+ }
18
+
19
+ h1 {
20
+ font-size: 3.2em;
21
+ line-height: 1.1;
22
+ }
23
+
24
+ button {
25
+ border-radius: 8px;
26
+ border: 1px solid transparent;
27
+ padding: 0.6em 1.2em;
28
+ font-size: 1em;
29
+ font-weight: 500;
30
+ font-family: inherit;
31
+ background-color: #f9f9f9;
32
+ cursor: pointer;
33
+ transition: border-color 0.25s;
34
+ }
35
+ button:hover {
36
+ border-color: #646cff;
37
+ }
38
+ button:focus,
39
+ button:focus-visible {
40
+ outline: 4px auto -webkit-focus-ring-color;
41
+ }
@@ -0,0 +1,10 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ </head>
7
+ <body>
8
+ <div id="root"></div>
9
+ </body>
10
+ </html>
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom/client';
3
+ import './index.css';
4
+ import App from './App';
5
+
6
+ const root = ReactDOM.createRoot(document.getElementById('root'));
7
+ root.render(
8
+ <React.StrictMode>
9
+ <App />
10
+ </React.StrictMode>,
11
+ );
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "rsbuild-react-ts",
3
+ "private": true,
4
+ "version": "1.0.0",
5
+ "scripts": {
6
+ "dev": "rsbuild dev",
7
+ "build": "rsbuild build",
8
+ "preview": "rsbuild preview"
9
+ },
10
+ "dependencies": {
11
+ "react": "^18",
12
+ "react-dom": "^18"
13
+ },
14
+ "devDependencies": {
15
+ "@rsbuild/core": "nightly",
16
+ "@rsbuild/plugin-react": "nightly",
17
+ "@types/react": "^18",
18
+ "@types/react-dom": "^18",
19
+ "typescript": "^5.0.0"
20
+ }
21
+ }
@@ -0,0 +1,9 @@
1
+ import { defineConfig } from '@rsbuild/core';
2
+ import { pluginReact } from '@rsbuild/plugin-react';
3
+
4
+ export default defineConfig({
5
+ plugins: [pluginReact()],
6
+ html: {
7
+ template: './src/index.html',
8
+ },
9
+ });
@@ -0,0 +1,22 @@
1
+ import { useState } from 'react';
2
+
3
+ const HelloWorld = () => {
4
+ const [count, setCount] = useState(0);
5
+
6
+ return (
7
+ <div>
8
+ <h1>Rsbuild + React</h1>
9
+
10
+ <div>
11
+ <button type="button" onClick={() => setCount(count + 1)}>
12
+ count is {count}
13
+ </button>
14
+ <p>
15
+ Edit <code>App.tsx</code> to test HMR
16
+ </p>
17
+ </div>
18
+ </div>
19
+ );
20
+ };
21
+
22
+ export default HelloWorld;
@@ -0,0 +1,41 @@
1
+ :root {
2
+ font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
3
+ font-size: 16px;
4
+ line-height: 24px;
5
+ font-weight: 400;
6
+ color: #213547;
7
+ background-color: #ffffff;
8
+ max-width: 1280px;
9
+ margin: 0 auto;
10
+ padding: 5rem;
11
+ text-align: center;
12
+ }
13
+
14
+ body {
15
+ margin: 0;
16
+ min-height: 100vh;
17
+ }
18
+
19
+ h1 {
20
+ font-size: 3.2em;
21
+ line-height: 1.1;
22
+ }
23
+
24
+ button {
25
+ border-radius: 8px;
26
+ border: 1px solid transparent;
27
+ padding: 0.6em 1.2em;
28
+ font-size: 1em;
29
+ font-weight: 500;
30
+ font-family: inherit;
31
+ background-color: #f9f9f9;
32
+ cursor: pointer;
33
+ transition: border-color 0.25s;
34
+ }
35
+ button:hover {
36
+ border-color: #646cff;
37
+ }
38
+ button:focus,
39
+ button:focus-visible {
40
+ outline: 4px auto -webkit-focus-ring-color;
41
+ }
@@ -0,0 +1,10 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ </head>
7
+ <body>
8
+ <div id="root"></div>
9
+ </body>
10
+ </html>
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom/client';
3
+ import './index.css';
4
+ import App from './App';
5
+
6
+ const root = ReactDOM.createRoot(document.getElementById('root')!);
7
+ root.render(
8
+ <React.StrictMode>
9
+ <App />
10
+ </React.StrictMode>,
11
+ );
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "lib": ["DOM", "ES2020"],
5
+ "module": "ESNext",
6
+ "jsx": "react-jsx",
7
+ "strict": true,
8
+ "skipLibCheck": true,
9
+ "isolatedModules": true,
10
+ "resolveJsonModule": true,
11
+ "moduleResolution": "bundler"
12
+ },
13
+ "include": ["src"]
14
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "rsbuild-vue2-js",
3
+ "private": true,
4
+ "version": "1.0.0",
5
+ "scripts": {
6
+ "dev": "rsbuild dev",
7
+ "build": "rsbuild build",
8
+ "preview": "rsbuild preview"
9
+ },
10
+ "dependencies": {
11
+ "vue": "^2.7.14"
12
+ },
13
+ "devDependencies": {
14
+ "@rsbuild/core": "nightly",
15
+ "@rsbuild/plugin-vue2": "nightly"
16
+ }
17
+ }
@@ -0,0 +1,9 @@
1
+ import { defineConfig } from '@rsbuild/core';
2
+ import { pluginVue2 } from '@rsbuild/plugin-vue2';
3
+
4
+ export default defineConfig({
5
+ plugins: [pluginVue2()],
6
+ html: {
7
+ template: './src/index.html',
8
+ },
9
+ });
@@ -0,0 +1,27 @@
1
+ <template>
2
+ <div>
3
+ <h1>Rsbuild + Vue</h1>
4
+
5
+ <div class="card">
6
+ <button type="button" @click="count++">count is {{ count }}</button>
7
+ <p>
8
+ Edit
9
+ <code>App.vue</code> to test HMR
10
+ </p>
11
+ </div>
12
+ </div>
13
+ </template>
14
+
15
+ <script>
16
+ export default {
17
+ data() {
18
+ return { count: 0 };
19
+ },
20
+ };
21
+ </script>
22
+
23
+ <style scoped>
24
+ .card {
25
+ padding: 2em;
26
+ }
27
+ </style>
@@ -0,0 +1,41 @@
1
+ :root {
2
+ font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
3
+ font-size: 16px;
4
+ line-height: 24px;
5
+ font-weight: 400;
6
+ color: #213547;
7
+ background-color: #ffffff;
8
+ max-width: 1280px;
9
+ margin: 0 auto;
10
+ padding: 5rem;
11
+ text-align: center;
12
+ }
13
+
14
+ body {
15
+ margin: 0;
16
+ min-height: 100vh;
17
+ }
18
+
19
+ h1 {
20
+ font-size: 3.2em;
21
+ line-height: 1.1;
22
+ }
23
+
24
+ button {
25
+ border-radius: 8px;
26
+ border: 1px solid transparent;
27
+ padding: 0.6em 1.2em;
28
+ font-size: 1em;
29
+ font-weight: 500;
30
+ font-family: inherit;
31
+ background-color: #f9f9f9;
32
+ cursor: pointer;
33
+ transition: border-color 0.25s;
34
+ }
35
+ button:hover {
36
+ border-color: #646cff;
37
+ }
38
+ button:focus,
39
+ button:focus-visible {
40
+ outline: 4px auto -webkit-focus-ring-color;
41
+ }
@@ -0,0 +1,10 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ </head>
7
+ <body>
8
+ <div id="root"></div>
9
+ </body>
10
+ </html>
@@ -0,0 +1,8 @@
1
+ import Vue from 'vue';
2
+ import './index.css';
3
+ import App from './App.vue';
4
+
5
+ new Vue({
6
+ el: '#root',
7
+ render: (h) => h(App),
8
+ });
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "rsbuild-vue2-ts",
3
+ "private": true,
4
+ "version": "1.0.0",
5
+ "scripts": {
6
+ "dev": "rsbuild dev",
7
+ "build": "rsbuild build",
8
+ "preview": "rsbuild preview"
9
+ },
10
+ "dependencies": {
11
+ "vue": "^2.7.14"
12
+ },
13
+ "devDependencies": {
14
+ "@rsbuild/core": "nightly",
15
+ "@rsbuild/plugin-vue2": "nightly",
16
+ "typescript": "^5.0.0"
17
+ }
18
+ }
@@ -0,0 +1,9 @@
1
+ import { defineConfig } from '@rsbuild/core';
2
+ import { pluginVue2 } from '@rsbuild/plugin-vue2';
3
+
4
+ export default defineConfig({
5
+ plugins: [pluginVue2()],
6
+ html: {
7
+ template: './src/index.html',
8
+ },
9
+ });
@@ -0,0 +1,29 @@
1
+ <template>
2
+ <div>
3
+ <h1>Rsbuild + Vue</h1>
4
+
5
+ <div class="card">
6
+ <button type="button" @click="count++">count is {{ count }}</button>
7
+ <p>
8
+ Edit
9
+ <code>App.vue</code> to test HMR
10
+ </p>
11
+ </div>
12
+ </div>
13
+ </template>
14
+
15
+ <script lang="ts">
16
+ import { defineComponent } from 'vue';
17
+
18
+ export default defineComponent({
19
+ data() {
20
+ return { count: 0 };
21
+ },
22
+ });
23
+ </script>
24
+
25
+ <style scoped>
26
+ .card {
27
+ padding: 2em;
28
+ }
29
+ </style>
@@ -0,0 +1,5 @@
1
+ declare module '*.vue' {
2
+ import Vue from 'vue';
3
+
4
+ export default Vue;
5
+ }
@@ -0,0 +1,41 @@
1
+ :root {
2
+ font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
3
+ font-size: 16px;
4
+ line-height: 24px;
5
+ font-weight: 400;
6
+ color: #213547;
7
+ background-color: #ffffff;
8
+ max-width: 1280px;
9
+ margin: 0 auto;
10
+ padding: 5rem;
11
+ text-align: center;
12
+ }
13
+
14
+ body {
15
+ margin: 0;
16
+ min-height: 100vh;
17
+ }
18
+
19
+ h1 {
20
+ font-size: 3.2em;
21
+ line-height: 1.1;
22
+ }
23
+
24
+ button {
25
+ border-radius: 8px;
26
+ border: 1px solid transparent;
27
+ padding: 0.6em 1.2em;
28
+ font-size: 1em;
29
+ font-weight: 500;
30
+ font-family: inherit;
31
+ background-color: #f9f9f9;
32
+ cursor: pointer;
33
+ transition: border-color 0.25s;
34
+ }
35
+ button:hover {
36
+ border-color: #646cff;
37
+ }
38
+ button:focus,
39
+ button:focus-visible {
40
+ outline: 4px auto -webkit-focus-ring-color;
41
+ }
@@ -0,0 +1,10 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ </head>
7
+ <body>
8
+ <div id="root"></div>
9
+ </body>
10
+ </html>
@@ -0,0 +1,8 @@
1
+ import Vue from 'vue';
2
+ import './index.css';
3
+ import App from './App.vue';
4
+
5
+ new Vue({
6
+ el: '#root',
7
+ render: (h) => h(App),
8
+ });
@@ -0,0 +1,13 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "lib": ["DOM", "ES2020"],
5
+ "module": "ESNext",
6
+ "strict": true,
7
+ "skipLibCheck": true,
8
+ "isolatedModules": true,
9
+ "resolveJsonModule": true,
10
+ "moduleResolution": "bundler"
11
+ },
12
+ "include": ["src"]
13
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "rsbuild-vue3-js",
3
+ "private": true,
4
+ "version": "1.0.0",
5
+ "scripts": {
6
+ "dev": "rsbuild dev",
7
+ "build": "rsbuild build",
8
+ "preview": "rsbuild preview"
9
+ },
10
+ "dependencies": {
11
+ "vue": "^3.0.0"
12
+ },
13
+ "devDependencies": {
14
+ "@rsbuild/core": "nightly",
15
+ "@rsbuild/plugin-vue": "nightly"
16
+ }
17
+ }
@@ -0,0 +1,9 @@
1
+ import { defineConfig } from '@rsbuild/core';
2
+ import { pluginVue } from '@rsbuild/plugin-vue';
3
+
4
+ export default defineConfig({
5
+ plugins: [pluginVue()],
6
+ html: {
7
+ template: './src/index.html',
8
+ },
9
+ });
@@ -0,0 +1,29 @@
1
+ <script setup>
2
+ import { ref } from 'vue';
3
+
4
+ defineProps({
5
+ msg: {
6
+ type: String,
7
+ },
8
+ });
9
+
10
+ const count = ref(0);
11
+ </script>
12
+
13
+ <template>
14
+ <h1>Rsbuild + Vue</h1>
15
+
16
+ <div class="card">
17
+ <button type="button" @click="count++">count is {{ count }}</button>
18
+ <p>
19
+ Edit
20
+ <code>App.vue</code> to test HMR
21
+ </p>
22
+ </div>
23
+ </template>
24
+
25
+ <style scoped>
26
+ .card {
27
+ padding: 2em;
28
+ }
29
+ </style>
@@ -0,0 +1,41 @@
1
+ :root {
2
+ font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
3
+ font-size: 16px;
4
+ line-height: 24px;
5
+ font-weight: 400;
6
+ color: #213547;
7
+ background-color: #ffffff;
8
+ max-width: 1280px;
9
+ margin: 0 auto;
10
+ padding: 5rem;
11
+ text-align: center;
12
+ }
13
+
14
+ body {
15
+ margin: 0;
16
+ min-height: 100vh;
17
+ }
18
+
19
+ h1 {
20
+ font-size: 3.2em;
21
+ line-height: 1.1;
22
+ }
23
+
24
+ button {
25
+ border-radius: 8px;
26
+ border: 1px solid transparent;
27
+ padding: 0.6em 1.2em;
28
+ font-size: 1em;
29
+ font-weight: 500;
30
+ font-family: inherit;
31
+ background-color: #f9f9f9;
32
+ cursor: pointer;
33
+ transition: border-color 0.25s;
34
+ }
35
+ button:hover {
36
+ border-color: #646cff;
37
+ }
38
+ button:focus,
39
+ button:focus-visible {
40
+ outline: 4px auto -webkit-focus-ring-color;
41
+ }
@@ -0,0 +1,10 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ </head>
7
+ <body>
8
+ <div id="root"></div>
9
+ </body>
10
+ </html>
@@ -0,0 +1,5 @@
1
+ import { createApp } from 'vue';
2
+ import './index.css';
3
+ import App from './App.vue';
4
+
5
+ createApp(App).mount('#root');
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "rsbuild-vue3-ts",
3
+ "private": true,
4
+ "version": "1.0.0",
5
+ "scripts": {
6
+ "dev": "rsbuild dev",
7
+ "build": "rsbuild build",
8
+ "preview": "rsbuild preview"
9
+ },
10
+ "dependencies": {
11
+ "vue": "^3.0.0"
12
+ },
13
+ "devDependencies": {
14
+ "@rsbuild/core": "nightly",
15
+ "@rsbuild/plugin-vue": "nightly",
16
+ "typescript": "^5.0.0"
17
+ }
18
+ }
@@ -0,0 +1,9 @@
1
+ import { defineConfig } from '@rsbuild/core';
2
+ import { pluginVue } from '@rsbuild/plugin-vue';
3
+
4
+ export default defineConfig({
5
+ plugins: [pluginVue()],
6
+ html: {
7
+ template: './src/index.html',
8
+ },
9
+ });
@@ -0,0 +1,23 @@
1
+ <script setup lang="ts">
2
+ import { ref } from 'vue';
3
+
4
+ const count = ref(0);
5
+ </script>
6
+
7
+ <template>
8
+ <h1>Rsbuild + Vue</h1>
9
+
10
+ <div class="card">
11
+ <button type="button" @click="count++">count is {{ count }}</button>
12
+ <p>
13
+ Edit
14
+ <code>App.vue</code> to test HMR
15
+ </p>
16
+ </div>
17
+ </template>
18
+
19
+ <style scoped>
20
+ .card {
21
+ padding: 2em;
22
+ }
23
+ </style>
@@ -0,0 +1,6 @@
1
+ declare module '*.vue' {
2
+ import type { DefineComponent } from 'vue';
3
+
4
+ const component: DefineComponent<{}, {}, any>;
5
+ export default component;
6
+ }
@@ -0,0 +1,41 @@
1
+ :root {
2
+ font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
3
+ font-size: 16px;
4
+ line-height: 24px;
5
+ font-weight: 400;
6
+ color: #213547;
7
+ background-color: #ffffff;
8
+ max-width: 1280px;
9
+ margin: 0 auto;
10
+ padding: 5rem;
11
+ text-align: center;
12
+ }
13
+
14
+ body {
15
+ margin: 0;
16
+ min-height: 100vh;
17
+ }
18
+
19
+ h1 {
20
+ font-size: 3.2em;
21
+ line-height: 1.1;
22
+ }
23
+
24
+ button {
25
+ border-radius: 8px;
26
+ border: 1px solid transparent;
27
+ padding: 0.6em 1.2em;
28
+ font-size: 1em;
29
+ font-weight: 500;
30
+ font-family: inherit;
31
+ background-color: #f9f9f9;
32
+ cursor: pointer;
33
+ transition: border-color 0.25s;
34
+ }
35
+ button:hover {
36
+ border-color: #646cff;
37
+ }
38
+ button:focus,
39
+ button:focus-visible {
40
+ outline: 4px auto -webkit-focus-ring-color;
41
+ }
@@ -0,0 +1,10 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ </head>
7
+ <body>
8
+ <div id="root"></div>
9
+ </body>
10
+ </html>
@@ -0,0 +1,5 @@
1
+ import { createApp } from 'vue';
2
+ import './index.css';
3
+ import App from './App.vue';
4
+
5
+ createApp(App).mount('#root');
@@ -0,0 +1,13 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "lib": ["DOM", "ES2020"],
5
+ "module": "ESNext",
6
+ "strict": true,
7
+ "skipLibCheck": true,
8
+ "isolatedModules": true,
9
+ "resolveJsonModule": true,
10
+ "moduleResolution": "bundler"
11
+ },
12
+ "include": ["src"]
13
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "@rsbuild/tsconfig/base",
3
+ "compilerOptions": {
4
+ "outDir": "./dist",
5
+ "baseUrl": "./"
6
+ },
7
+ "include": ["src"]
8
+ }