Skip to content

Commit 85697f2

Browse files
committed
格式化
1 parent d0a1bbc commit 85697f2

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

README.md

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,47 +9,48 @@ npm install @masx200/rollup-plugin-http-resolve --save
99
```ts
1010
import { fileCache, httpResolve } from "@masx200/rollup-plugin-http-resolve";
1111

12-
httpResolve({ cache: new fileCache() })
13-
```
12+
httpResolve({ cache: new fileCache() });
13+
```
14+
1415
## Example
1516

1617
```ts
1718
// rollup.config.js
1819
import { httpResolve } from "@masx200/rollup-plugin-http-resolve";
1920
export default {
20-
input: "index.js",
21-
plugins: [
22-
httpResolve({
23-
cache,
24-
}),
25-
],
21+
input: "index.js",
22+
plugins: [
23+
httpResolve({
24+
cache,
25+
}),
26+
],
2627
};
2728
```
2829

2930
## Example: CDN Resolve
3031

3132
```ts
3233
const vol = Volume.fromJSON({
33-
"/index.js": `
34+
"/index.js": `
3435
import {h} from "preact";
3536
console.log(h);
3637
`,
3738
});
3839

3940
const memfs = createFs(vol) as IPromisesAPI;
4041
const rolled = await rollup({
41-
input: "/index.js",
42-
plugins: [
43-
httpResolve({
44-
fallback(id) {
45-
// Avoid local relative path
46-
if (!id.startsWith(".")) {
47-
return `https://esm.sh/${id}`;
48-
}
49-
},
50-
}),
51-
memfsPlugin(memfs),
52-
],
42+
input: "/index.js",
43+
plugins: [
44+
httpResolve({
45+
fallback(id) {
46+
// Avoid local relative path
47+
if (!id.startsWith(".")) {
48+
return `https://esm.sh/${id}`;
49+
}
50+
},
51+
}),
52+
memfsPlugin(memfs),
53+
],
5354
});
5455
const out = await rolled.generate({ format: "es" });
5556
const code = out.output[0].code;

0 commit comments

Comments
 (0)