unplugin-https-reverse-proxy 0.0.18 → 0.0.20
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.
- package/README.md +53 -17
- package/dist/{chunk-D3S54OXA.js → chunk-CVO5VP4I.js} +1 -1
- package/dist/{chunk-HXDI3VOY.js → chunk-KYPQLMHO.js} +8 -2
- package/dist/{chunk-6MDRTXCZ.js → chunk-VXVYW4ZE.js} +1 -1
- package/dist/esbuild.cjs +8 -2
- package/dist/esbuild.js +1 -1
- package/dist/index.cjs +8 -2
- package/dist/index.js +1 -1
- package/dist/nuxt.cjs +8 -2
- package/dist/nuxt.js +3 -3
- package/dist/rollup.cjs +8 -2
- package/dist/rollup.js +1 -1
- package/dist/vite.cjs +8 -2
- package/dist/vite.js +2 -2
- package/dist/webpack.cjs +8 -2
- package/dist/webpack.js +2 -2
- package/package.json +1 -1
- package/src/index.ts +12 -2
package/README.md
CHANGED
|
@@ -16,10 +16,14 @@ UHRP_AUTO_INSTALL_CADDY=true npm i unplugin-https-reverse-proxy --save-dev
|
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
18
|
interface Options {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
/** default: true */
|
|
20
|
+
enable?: boolean
|
|
21
|
+
/** target hostname */
|
|
22
|
+
target: string
|
|
23
|
+
/** default: false */
|
|
24
|
+
showCaddyLog?: boolean
|
|
25
|
+
/** default: false */
|
|
26
|
+
https?: boolean
|
|
23
27
|
}
|
|
24
28
|
```
|
|
25
29
|
|
|
@@ -44,24 +48,40 @@ Example: [`playground/`](./playground/)
|
|
|
44
48
|
<details>
|
|
45
49
|
<summary>Webpack</summary><br>
|
|
46
50
|
|
|
47
|
-
```
|
|
51
|
+
```js
|
|
48
52
|
// webpack.config.js
|
|
53
|
+
|
|
54
|
+
/** @type {Parameters<import('unplugin-https-reverse-proxy/webpack')['default']>[0]} */
|
|
55
|
+
const reverseProxyOptions = {
|
|
56
|
+
enable: false,
|
|
57
|
+
target: 'xxx',
|
|
58
|
+
https: false,
|
|
59
|
+
}
|
|
60
|
+
|
|
49
61
|
module.exports = {
|
|
50
62
|
/* ... */
|
|
51
63
|
devServer: {
|
|
52
64
|
client: {
|
|
53
65
|
// ↓ for HMR
|
|
54
66
|
webSocketURL: {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
67
|
+
...(reverseProxyOptions.enable
|
|
68
|
+
? {
|
|
69
|
+
hostname: reverseProxyOptions.target,
|
|
70
|
+
}
|
|
71
|
+
: {}),
|
|
72
|
+
...(reverseProxyOptions.enable && reverseProxyOptions.https
|
|
73
|
+
? {
|
|
74
|
+
protocol: 'wss',
|
|
75
|
+
port: 443,
|
|
76
|
+
}
|
|
77
|
+
: {})
|
|
78
|
+
}
|
|
59
79
|
},
|
|
60
80
|
setupExitSignals: true,
|
|
61
81
|
allowedHosts: 'all',
|
|
62
82
|
},
|
|
63
83
|
plugins: [
|
|
64
|
-
require('unplugin-https-reverse-proxy/webpack')(
|
|
84
|
+
require('unplugin-https-reverse-proxy/webpack')(reverseProxyOptions)
|
|
65
85
|
]
|
|
66
86
|
}
|
|
67
87
|
```
|
|
@@ -71,7 +91,7 @@ module.exports = {
|
|
|
71
91
|
<details>
|
|
72
92
|
<summary>Nuxt</summary><br>
|
|
73
93
|
|
|
74
|
-
```
|
|
94
|
+
```js
|
|
75
95
|
// nuxt.config.js
|
|
76
96
|
export default defineNuxtConfig({
|
|
77
97
|
modules: [
|
|
@@ -87,24 +107,40 @@ export default defineNuxtConfig({
|
|
|
87
107
|
<details>
|
|
88
108
|
<summary>Vue CLI</summary><br>
|
|
89
109
|
|
|
90
|
-
```
|
|
110
|
+
```js
|
|
91
111
|
// vue.config.js
|
|
112
|
+
|
|
113
|
+
/** @type {Parameters<import('unplugin-https-reverse-proxy/webpack')['default']>[0]} */
|
|
114
|
+
const reverseProxyOptions = {
|
|
115
|
+
enable: false,
|
|
116
|
+
target: 'xxx',
|
|
117
|
+
https: false,
|
|
118
|
+
}
|
|
119
|
+
|
|
92
120
|
module.exports = {
|
|
93
121
|
devServer: {
|
|
94
122
|
client: {
|
|
95
123
|
// ↓ for HMR
|
|
96
124
|
webSocketURL: {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
125
|
+
...(reverseProxyOptions.enable
|
|
126
|
+
? {
|
|
127
|
+
hostname: reverseProxyOptions.target,
|
|
128
|
+
}
|
|
129
|
+
: {}),
|
|
130
|
+
...(reverseProxyOptions.enable && reverseProxyOptions.https
|
|
131
|
+
? {
|
|
132
|
+
protocol: 'wss',
|
|
133
|
+
port: 443,
|
|
134
|
+
}
|
|
135
|
+
: {})
|
|
136
|
+
}
|
|
101
137
|
},
|
|
102
138
|
setupExitSignals: true,
|
|
103
139
|
allowedHosts: 'all',
|
|
104
140
|
},
|
|
105
141
|
configureWebpack: {
|
|
106
142
|
plugins: [
|
|
107
|
-
require('unplugin-https-reverse-proxy/webpack')(
|
|
143
|
+
require('unplugin-https-reverse-proxy/webpack')(reverseProxyOptions),
|
|
108
144
|
],
|
|
109
145
|
},
|
|
110
146
|
}
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
|
|
7
7
|
// src/index.ts
|
|
8
8
|
import process3 from "process";
|
|
9
|
+
import { chmodSync as chmodSync2 } from "fs";
|
|
9
10
|
import { createUnplugin } from "unplugin";
|
|
10
11
|
import c from "picocolors";
|
|
11
12
|
|
|
@@ -390,11 +391,11 @@ function registerExit(clear) {
|
|
|
390
391
|
});
|
|
391
392
|
process3.once("SIGINT", async () => {
|
|
392
393
|
await clear();
|
|
393
|
-
process3.
|
|
394
|
+
process3.exit(0);
|
|
394
395
|
});
|
|
395
396
|
process3.once("SIGTERM", async () => {
|
|
396
397
|
await clear();
|
|
397
|
-
process3.
|
|
398
|
+
process3.exit(0);
|
|
398
399
|
});
|
|
399
400
|
}
|
|
400
401
|
var unpluginFactory = (options) => ({
|
|
@@ -436,6 +437,9 @@ var unpluginFactory = (options) => ({
|
|
|
436
437
|
server.printUrls = () => {
|
|
437
438
|
var _a;
|
|
438
439
|
_printUrls();
|
|
440
|
+
const pwd = process3.cwd();
|
|
441
|
+
const vireCacheDir = `${pwd}/node_modules/.vite`;
|
|
442
|
+
chmodSync2(vireCacheDir, 511);
|
|
439
443
|
let source = `localhost:${config.server.port}`;
|
|
440
444
|
const url = (_a = server.resolvedUrls) == null ? void 0 : _a.local[0];
|
|
441
445
|
if (url) {
|
|
@@ -463,6 +467,8 @@ var unpluginFactory = (options) => ({
|
|
|
463
467
|
}
|
|
464
468
|
},
|
|
465
469
|
webpack(compiler) {
|
|
470
|
+
if (process3.env.NODE_ENV !== "development")
|
|
471
|
+
return;
|
|
466
472
|
const {
|
|
467
473
|
enable = true,
|
|
468
474
|
target = ""
|
package/dist/esbuild.cjs
CHANGED
|
@@ -51,6 +51,7 @@ var import_unplugin2 = require("unplugin");
|
|
|
51
51
|
|
|
52
52
|
// src/index.ts
|
|
53
53
|
var import_node_process3 = __toESM(require("process"), 1);
|
|
54
|
+
var import_node_fs2 = require("fs");
|
|
54
55
|
var import_unplugin = require("unplugin");
|
|
55
56
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
56
57
|
|
|
@@ -450,11 +451,11 @@ function registerExit(clear) {
|
|
|
450
451
|
});
|
|
451
452
|
import_node_process3.default.once("SIGINT", async () => {
|
|
452
453
|
await clear();
|
|
453
|
-
import_node_process3.default.
|
|
454
|
+
import_node_process3.default.exit(0);
|
|
454
455
|
});
|
|
455
456
|
import_node_process3.default.once("SIGTERM", async () => {
|
|
456
457
|
await clear();
|
|
457
|
-
import_node_process3.default.
|
|
458
|
+
import_node_process3.default.exit(0);
|
|
458
459
|
});
|
|
459
460
|
}
|
|
460
461
|
var unpluginFactory = (options) => ({
|
|
@@ -496,6 +497,9 @@ var unpluginFactory = (options) => ({
|
|
|
496
497
|
server.printUrls = () => {
|
|
497
498
|
var _a;
|
|
498
499
|
_printUrls();
|
|
500
|
+
const pwd = import_node_process3.default.cwd();
|
|
501
|
+
const vireCacheDir = `${pwd}/node_modules/.vite`;
|
|
502
|
+
(0, import_node_fs2.chmodSync)(vireCacheDir, 511);
|
|
499
503
|
let source = `localhost:${config.server.port}`;
|
|
500
504
|
const url = (_a = server.resolvedUrls) == null ? void 0 : _a.local[0];
|
|
501
505
|
if (url) {
|
|
@@ -523,6 +527,8 @@ var unpluginFactory = (options) => ({
|
|
|
523
527
|
}
|
|
524
528
|
},
|
|
525
529
|
webpack(compiler) {
|
|
530
|
+
if (import_node_process3.default.env.NODE_ENV !== "development")
|
|
531
|
+
return;
|
|
526
532
|
const {
|
|
527
533
|
enable = true,
|
|
528
534
|
target = ""
|
package/dist/esbuild.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -50,6 +50,7 @@ __export(src_exports, {
|
|
|
50
50
|
});
|
|
51
51
|
module.exports = __toCommonJS(src_exports);
|
|
52
52
|
var import_node_process3 = __toESM(require("process"), 1);
|
|
53
|
+
var import_node_fs2 = require("fs");
|
|
53
54
|
var import_unplugin = require("unplugin");
|
|
54
55
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
55
56
|
|
|
@@ -449,11 +450,11 @@ function registerExit(clear) {
|
|
|
449
450
|
});
|
|
450
451
|
import_node_process3.default.once("SIGINT", async () => {
|
|
451
452
|
await clear();
|
|
452
|
-
import_node_process3.default.
|
|
453
|
+
import_node_process3.default.exit(0);
|
|
453
454
|
});
|
|
454
455
|
import_node_process3.default.once("SIGTERM", async () => {
|
|
455
456
|
await clear();
|
|
456
|
-
import_node_process3.default.
|
|
457
|
+
import_node_process3.default.exit(0);
|
|
457
458
|
});
|
|
458
459
|
}
|
|
459
460
|
var unpluginFactory = (options) => ({
|
|
@@ -495,6 +496,9 @@ var unpluginFactory = (options) => ({
|
|
|
495
496
|
server.printUrls = () => {
|
|
496
497
|
var _a;
|
|
497
498
|
_printUrls();
|
|
499
|
+
const pwd = import_node_process3.default.cwd();
|
|
500
|
+
const vireCacheDir = `${pwd}/node_modules/.vite`;
|
|
501
|
+
(0, import_node_fs2.chmodSync)(vireCacheDir, 511);
|
|
498
502
|
let source = `localhost:${config.server.port}`;
|
|
499
503
|
const url = (_a = server.resolvedUrls) == null ? void 0 : _a.local[0];
|
|
500
504
|
if (url) {
|
|
@@ -522,6 +526,8 @@ var unpluginFactory = (options) => ({
|
|
|
522
526
|
}
|
|
523
527
|
},
|
|
524
528
|
webpack(compiler) {
|
|
529
|
+
if (import_node_process3.default.env.NODE_ENV !== "development")
|
|
530
|
+
return;
|
|
525
531
|
const {
|
|
526
532
|
enable = true,
|
|
527
533
|
target = ""
|
package/dist/index.js
CHANGED
package/dist/nuxt.cjs
CHANGED
|
@@ -54,6 +54,7 @@ var import_unplugin2 = require("unplugin");
|
|
|
54
54
|
|
|
55
55
|
// src/index.ts
|
|
56
56
|
var import_node_process3 = __toESM(require("process"), 1);
|
|
57
|
+
var import_node_fs2 = require("fs");
|
|
57
58
|
var import_unplugin = require("unplugin");
|
|
58
59
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
59
60
|
|
|
@@ -453,11 +454,11 @@ function registerExit(clear) {
|
|
|
453
454
|
});
|
|
454
455
|
import_node_process3.default.once("SIGINT", async () => {
|
|
455
456
|
await clear();
|
|
456
|
-
import_node_process3.default.
|
|
457
|
+
import_node_process3.default.exit(0);
|
|
457
458
|
});
|
|
458
459
|
import_node_process3.default.once("SIGTERM", async () => {
|
|
459
460
|
await clear();
|
|
460
|
-
import_node_process3.default.
|
|
461
|
+
import_node_process3.default.exit(0);
|
|
461
462
|
});
|
|
462
463
|
}
|
|
463
464
|
var unpluginFactory = (options) => ({
|
|
@@ -499,6 +500,9 @@ var unpluginFactory = (options) => ({
|
|
|
499
500
|
server.printUrls = () => {
|
|
500
501
|
var _a;
|
|
501
502
|
_printUrls();
|
|
503
|
+
const pwd = import_node_process3.default.cwd();
|
|
504
|
+
const vireCacheDir = `${pwd}/node_modules/.vite`;
|
|
505
|
+
(0, import_node_fs2.chmodSync)(vireCacheDir, 511);
|
|
502
506
|
let source = `localhost:${config.server.port}`;
|
|
503
507
|
const url = (_a = server.resolvedUrls) == null ? void 0 : _a.local[0];
|
|
504
508
|
if (url) {
|
|
@@ -526,6 +530,8 @@ var unpluginFactory = (options) => ({
|
|
|
526
530
|
}
|
|
527
531
|
},
|
|
528
532
|
webpack(compiler) {
|
|
533
|
+
if (import_node_process3.default.env.NODE_ENV !== "development")
|
|
534
|
+
return;
|
|
529
535
|
const {
|
|
530
536
|
enable = true,
|
|
531
537
|
target = ""
|
package/dist/nuxt.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
vite_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CVO5VP4I.js";
|
|
4
4
|
import {
|
|
5
5
|
webpack_default
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-VXVYW4ZE.js";
|
|
7
|
+
import "./chunk-KYPQLMHO.js";
|
|
8
8
|
import "./chunk-CQC5SSJR.js";
|
|
9
9
|
|
|
10
10
|
// src/nuxt.ts
|
package/dist/rollup.cjs
CHANGED
|
@@ -51,6 +51,7 @@ var import_unplugin2 = require("unplugin");
|
|
|
51
51
|
|
|
52
52
|
// src/index.ts
|
|
53
53
|
var import_node_process3 = __toESM(require("process"), 1);
|
|
54
|
+
var import_node_fs2 = require("fs");
|
|
54
55
|
var import_unplugin = require("unplugin");
|
|
55
56
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
56
57
|
|
|
@@ -450,11 +451,11 @@ function registerExit(clear) {
|
|
|
450
451
|
});
|
|
451
452
|
import_node_process3.default.once("SIGINT", async () => {
|
|
452
453
|
await clear();
|
|
453
|
-
import_node_process3.default.
|
|
454
|
+
import_node_process3.default.exit(0);
|
|
454
455
|
});
|
|
455
456
|
import_node_process3.default.once("SIGTERM", async () => {
|
|
456
457
|
await clear();
|
|
457
|
-
import_node_process3.default.
|
|
458
|
+
import_node_process3.default.exit(0);
|
|
458
459
|
});
|
|
459
460
|
}
|
|
460
461
|
var unpluginFactory = (options) => ({
|
|
@@ -496,6 +497,9 @@ var unpluginFactory = (options) => ({
|
|
|
496
497
|
server.printUrls = () => {
|
|
497
498
|
var _a;
|
|
498
499
|
_printUrls();
|
|
500
|
+
const pwd = import_node_process3.default.cwd();
|
|
501
|
+
const vireCacheDir = `${pwd}/node_modules/.vite`;
|
|
502
|
+
(0, import_node_fs2.chmodSync)(vireCacheDir, 511);
|
|
499
503
|
let source = `localhost:${config.server.port}`;
|
|
500
504
|
const url = (_a = server.resolvedUrls) == null ? void 0 : _a.local[0];
|
|
501
505
|
if (url) {
|
|
@@ -523,6 +527,8 @@ var unpluginFactory = (options) => ({
|
|
|
523
527
|
}
|
|
524
528
|
},
|
|
525
529
|
webpack(compiler) {
|
|
530
|
+
if (import_node_process3.default.env.NODE_ENV !== "development")
|
|
531
|
+
return;
|
|
526
532
|
const {
|
|
527
533
|
enable = true,
|
|
528
534
|
target = ""
|
package/dist/rollup.js
CHANGED
package/dist/vite.cjs
CHANGED
|
@@ -51,6 +51,7 @@ var import_unplugin2 = require("unplugin");
|
|
|
51
51
|
|
|
52
52
|
// src/index.ts
|
|
53
53
|
var import_node_process3 = __toESM(require("process"), 1);
|
|
54
|
+
var import_node_fs2 = require("fs");
|
|
54
55
|
var import_unplugin = require("unplugin");
|
|
55
56
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
56
57
|
|
|
@@ -450,11 +451,11 @@ function registerExit(clear) {
|
|
|
450
451
|
});
|
|
451
452
|
import_node_process3.default.once("SIGINT", async () => {
|
|
452
453
|
await clear();
|
|
453
|
-
import_node_process3.default.
|
|
454
|
+
import_node_process3.default.exit(0);
|
|
454
455
|
});
|
|
455
456
|
import_node_process3.default.once("SIGTERM", async () => {
|
|
456
457
|
await clear();
|
|
457
|
-
import_node_process3.default.
|
|
458
|
+
import_node_process3.default.exit(0);
|
|
458
459
|
});
|
|
459
460
|
}
|
|
460
461
|
var unpluginFactory = (options) => ({
|
|
@@ -496,6 +497,9 @@ var unpluginFactory = (options) => ({
|
|
|
496
497
|
server.printUrls = () => {
|
|
497
498
|
var _a;
|
|
498
499
|
_printUrls();
|
|
500
|
+
const pwd = import_node_process3.default.cwd();
|
|
501
|
+
const vireCacheDir = `${pwd}/node_modules/.vite`;
|
|
502
|
+
(0, import_node_fs2.chmodSync)(vireCacheDir, 511);
|
|
499
503
|
let source = `localhost:${config.server.port}`;
|
|
500
504
|
const url = (_a = server.resolvedUrls) == null ? void 0 : _a.local[0];
|
|
501
505
|
if (url) {
|
|
@@ -523,6 +527,8 @@ var unpluginFactory = (options) => ({
|
|
|
523
527
|
}
|
|
524
528
|
},
|
|
525
529
|
webpack(compiler) {
|
|
530
|
+
if (import_node_process3.default.env.NODE_ENV !== "development")
|
|
531
|
+
return;
|
|
526
532
|
const {
|
|
527
533
|
enable = true,
|
|
528
534
|
target = ""
|
package/dist/vite.js
CHANGED
package/dist/webpack.cjs
CHANGED
|
@@ -51,6 +51,7 @@ var import_unplugin2 = require("unplugin");
|
|
|
51
51
|
|
|
52
52
|
// src/index.ts
|
|
53
53
|
var import_node_process3 = __toESM(require("process"), 1);
|
|
54
|
+
var import_node_fs2 = require("fs");
|
|
54
55
|
var import_unplugin = require("unplugin");
|
|
55
56
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
56
57
|
|
|
@@ -450,11 +451,11 @@ function registerExit(clear) {
|
|
|
450
451
|
});
|
|
451
452
|
import_node_process3.default.once("SIGINT", async () => {
|
|
452
453
|
await clear();
|
|
453
|
-
import_node_process3.default.
|
|
454
|
+
import_node_process3.default.exit(0);
|
|
454
455
|
});
|
|
455
456
|
import_node_process3.default.once("SIGTERM", async () => {
|
|
456
457
|
await clear();
|
|
457
|
-
import_node_process3.default.
|
|
458
|
+
import_node_process3.default.exit(0);
|
|
458
459
|
});
|
|
459
460
|
}
|
|
460
461
|
var unpluginFactory = (options) => ({
|
|
@@ -496,6 +497,9 @@ var unpluginFactory = (options) => ({
|
|
|
496
497
|
server.printUrls = () => {
|
|
497
498
|
var _a;
|
|
498
499
|
_printUrls();
|
|
500
|
+
const pwd = import_node_process3.default.cwd();
|
|
501
|
+
const vireCacheDir = `${pwd}/node_modules/.vite`;
|
|
502
|
+
(0, import_node_fs2.chmodSync)(vireCacheDir, 511);
|
|
499
503
|
let source = `localhost:${config.server.port}`;
|
|
500
504
|
const url = (_a = server.resolvedUrls) == null ? void 0 : _a.local[0];
|
|
501
505
|
if (url) {
|
|
@@ -523,6 +527,8 @@ var unpluginFactory = (options) => ({
|
|
|
523
527
|
}
|
|
524
528
|
},
|
|
525
529
|
webpack(compiler) {
|
|
530
|
+
if (import_node_process3.default.env.NODE_ENV !== "development")
|
|
531
|
+
return;
|
|
526
532
|
const {
|
|
527
533
|
enable = true,
|
|
528
534
|
target = ""
|
package/dist/webpack.js
CHANGED
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
|
+
import { chmodSync } from 'node:fs'
|
|
2
3
|
import type { UnpluginFactory } from 'unplugin'
|
|
3
4
|
import { createUnplugin } from 'unplugin'
|
|
4
5
|
import type { ResolvedConfig, ViteDevServer } from 'vite'
|
|
@@ -37,12 +38,12 @@ function registerExit(clear: (() => Promise<any>) | (() => any)) {
|
|
|
37
38
|
|
|
38
39
|
process.once('SIGINT', async () => {
|
|
39
40
|
await clear()
|
|
40
|
-
process.
|
|
41
|
+
process.exit(0)
|
|
41
42
|
})
|
|
42
43
|
|
|
43
44
|
process.once('SIGTERM', async () => {
|
|
44
45
|
await clear()
|
|
45
|
-
process.
|
|
46
|
+
process.exit(0)
|
|
46
47
|
})
|
|
47
48
|
}
|
|
48
49
|
|
|
@@ -87,6 +88,12 @@ export const unpluginFactory: UnpluginFactory<Options> = options => ({
|
|
|
87
88
|
const _printUrls = server.printUrls
|
|
88
89
|
server.printUrls = () => {
|
|
89
90
|
_printUrls()
|
|
91
|
+
|
|
92
|
+
// fix `Error: EPERM: operation not permitted`
|
|
93
|
+
const pwd = process.cwd()
|
|
94
|
+
const vireCacheDir = `${pwd}/node_modules/.vite`
|
|
95
|
+
chmodSync(vireCacheDir, 0o777)
|
|
96
|
+
|
|
90
97
|
let source = `localhost:${config.server.port}`
|
|
91
98
|
const url = server.resolvedUrls?.local[0]
|
|
92
99
|
if (url) {
|
|
@@ -116,6 +123,9 @@ export const unpluginFactory: UnpluginFactory<Options> = options => ({
|
|
|
116
123
|
},
|
|
117
124
|
},
|
|
118
125
|
webpack(compiler) {
|
|
126
|
+
if (process.env.NODE_ENV !== 'development')
|
|
127
|
+
return
|
|
128
|
+
|
|
119
129
|
const {
|
|
120
130
|
enable = true,
|
|
121
131
|
target = '',
|