makepack 1.5.17 → 1.5.19
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/package.json
CHANGED
|
@@ -39,35 +39,30 @@ const start = async () => {
|
|
|
39
39
|
process.exit(1)
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
startServer(config)
|
|
43
42
|
const expressjs = path.join(process.cwd(), 'express.js')
|
|
44
43
|
const expressts = path.join(process.cwd(), 'express.ts')
|
|
45
44
|
|
|
46
45
|
if (fs.existsSync(expressjs) || fs.existsSync(expressts)) {
|
|
47
46
|
let filename = fs.existsSync(expressjs) ? "express.js" : "express.ts";
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
47
|
+
let outfile = path.resolve(__dirname, 'user-express.js')
|
|
48
|
+
|
|
49
|
+
const ctx = await esbuild.context({
|
|
50
|
+
entryPoints: [filename],
|
|
51
|
+
outfile: path.resolve(__dirname, 'user-express.js'),
|
|
52
|
+
bundle: true,
|
|
53
|
+
format: 'esm',
|
|
54
|
+
platform: 'node',
|
|
55
|
+
external: ['express'],
|
|
56
|
+
})
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
ctx.watch()
|
|
59
59
|
|
|
60
|
-
const watcher = chokidar.watch(
|
|
60
|
+
const watcher = chokidar.watch(outfile, {
|
|
61
61
|
persistent: true,
|
|
62
62
|
ignoreInitial: true,
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
watcher.on('change', async () => {
|
|
66
|
-
build()
|
|
67
|
-
startServer(config)
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
watcher.on('unlink', (path) => {
|
|
71
66
|
startServer(config)
|
|
72
67
|
});
|
|
73
68
|
|
|
@@ -76,6 +71,7 @@ const start = async () => {
|
|
|
76
71
|
process.exit(0);
|
|
77
72
|
});
|
|
78
73
|
}
|
|
74
|
+
startServer(config)
|
|
79
75
|
}
|
|
80
76
|
|
|
81
77
|
export default start
|
|
@@ -7,6 +7,7 @@ const viteSetup = async (app) => {
|
|
|
7
7
|
const config = await makepackConfig()
|
|
8
8
|
const viteConfig = {
|
|
9
9
|
root: process.cwd(),
|
|
10
|
+
base: "/",
|
|
10
11
|
// plugins: [react()],
|
|
11
12
|
server: {
|
|
12
13
|
middlewareMode: true,
|
|
@@ -26,6 +27,7 @@ const viteSetup = async (app) => {
|
|
|
26
27
|
|
|
27
28
|
app.get('*', async (req, res, next) => {
|
|
28
29
|
const url = req.originalUrl;
|
|
30
|
+
|
|
29
31
|
try {
|
|
30
32
|
let template = await vite.transformIndexHtml(url, `
|
|
31
33
|
<!doctype html>
|
|
@@ -40,6 +42,7 @@ const viteSetup = async (app) => {
|
|
|
40
42
|
</body>
|
|
41
43
|
</html>
|
|
42
44
|
`);
|
|
45
|
+
|
|
43
46
|
res.status(200).set({
|
|
44
47
|
'Content-Type': 'text/html'
|
|
45
48
|
}).end(template);
|