Skip to content

Commit 2e554cf

Browse files
committed
优化sw.ts打包支持打包入node_modules
1 parent efc70d5 commit 2e554cf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

_blogs/HTML5/ServiceWorker/在Next.ts中使用ServiceWorker.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ ts 代码提示所需
4545
#### 安装 rollup 和相关插件
4646

4747
```bash
48-
yarn add -D rollup rollup-plugin-ts @rollup/plugin-typescript
48+
yarn add -D rollup rollup-plugin-ts @rollup/plugin-typescript @rollup/plugin-node-resolve
4949
```
5050

5151
#### 配置 rollup 编译 ts
@@ -56,6 +56,7 @@ yarn add -D rollup rollup-plugin-ts @rollup/plugin-typescript
5656

5757
```ts
5858
import ts from "rollup-plugin-ts";
59+
import { nodeResolve } from "@rollup/plugin-node-resolve";
5960

6061
/** @type {import('rollup').RollupOptions} */
6162
export default {
@@ -69,6 +70,7 @@ export default {
6970
ts({
7071
tsconfig: "service-worker/tsconfig.json",
7172
}),
73+
nodeResolve(),
7274
],
7375
};
7476
```

0 commit comments

Comments
 (0)