Skip to content

Commit 92fcb9d

Browse files
committed
workflow: use esbuild for dev scripts
1 parent 77283f4 commit 92fcb9d

File tree

5 files changed

+314
-47
lines changed

5 files changed

+314
-47
lines changed

.github/contributing.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,19 @@ The `dev` script bundles a target package (default: `vue`) in a specified format
123123
```bash
124124
$ nr dev
125125

126-
> rollup v1.19.4
127-
> bundles packages/vue/src/index.ts → packages/vue/dist/vue.global.js...
126+
> watching: packages/vue/dist/vue.global.js
128127
```
129128

130-
- The `dev` script also supports fuzzy match for the target package, but will only match the first package matched.
129+
- **Important:** output of the `dev` script is for development and debugging only. While it has the same runtime behavior, the generated code should never be published to npm.
130+
131+
- The `dev` script does not support fuzzy match - you must specify the full package name, e.g. `nr dev runtime-core`.
131132

132133
- The `dev` script supports specifying build format via the `-f` flag just like the `build` script.
133134

134135
- The `dev` script also supports the `-s` flag for generating source maps, but it will make rebuilds slower.
135136

137+
- The `dev` script supports the `-i` flag for inlining all deps. This is useful when debugging `esm-bundler` builds which externalizes deps by default.
138+
136139
### `nr dev-compiler`
137140

138141
The `dev-compiler` script builds, watches and serves the [Template Explorer](https://github.com/vuejs/vue-next/tree/master/packages/template-explorer) at `http://localhost:5000`. This is extremely useful when working on the compiler.

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"release": "node scripts/release.js",
1919
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
2020
"dev-compiler": "run-p \"dev template-explorer\" serve",
21-
"dev-sfc": "run-p \"dev compiler-sfc -- -f esm-browser\" \"dev runtime-core -- -f esm-bundler\" \"dev runtime-dom -- -f esm-bundler\" serve-sfc-playground",
21+
"dev-sfc": "run-p \"dev compiler-sfc -- -f esm-browser\" \"dev vue -- -if esm-bundler-runtime \" serve-sfc-playground",
2222
"serve-sfc-playground": "vite packages/sfc-playground --host",
2323
"serve": "serve",
2424
"open": "open http://localhost:5000/packages/template-explorer/local.html",
@@ -48,6 +48,7 @@
4848
},
4949
"devDependencies": {
5050
"@babel/types": "^7.12.0",
51+
"@esbuild-plugins/node-modules-polyfill": "^0.1.4",
5152
"@microsoft/api-extractor": "^7.15.1",
5253
"@rollup/plugin-commonjs": "^18.0.0",
5354
"@rollup/plugin-json": "^4.0.0",
@@ -66,6 +67,7 @@
6667
"conventional-changelog-cli": "^2.0.31",
6768
"csstype": "^3.0.3",
6869
"enquirer": "^2.3.2",
70+
"esbuild": "^0.14.11",
6971
"eslint": "^7.7.0",
7072
"execa": "^4.0.2",
7173
"fs-extra": "^9.0.1",
@@ -86,11 +88,11 @@
8688
"semver": "^7.3.2",
8789
"serve": "^12.0.0",
8890
"todomvc-app-css": "^2.3.0",
89-
"tslib": "^2.3.1",
9091
"ts-jest": "^27.0.5",
92+
"tslib": "^2.3.1",
9193
"typescript": "^4.2.2",
92-
"vue": "workspace:*",
9394
"vite": "^2.7.1",
95+
"vue": "workspace:*",
9496
"yorkie": "^2.0.0"
9597
}
9698
}

packages/template-explorer/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ window.init = () => {
6262
if (persistedState) {
6363
// functions are not persistable, so delete it in case we sometimes need
6464
// to debug with custom nodeTransforms
65-
delete persistedState.options.nodeTransforms
65+
delete persistedState.options?.nodeTransforms
6666
ssrMode.value = persistedState.ssr
6767
Object.assign(compilerOptions, persistedState.options)
6868
}
@@ -142,7 +142,7 @@ window.init = () => {
142142
}
143143

144144
const editor = monaco.editor.create(document.getElementById('source')!, {
145-
value: persistedState?.src || `<div>Hello World!</div>`,
145+
value: persistedState?.src || `<div>Hello World</div>`,
146146
language: 'html',
147147
...sharedEditorOptions,
148148
wordWrap: 'bounded'

0 commit comments

Comments
 (0)