Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
try vite plugin
Browse files- Dockerfile +1 -1
- package-lock.json +6 -0
- package.json +1 -0
- custom-plugin.ts β plugin.js +7 -9
- vite.config.ts +2 -2
Dockerfile
CHANGED
@@ -20,7 +20,7 @@ RUN chmod +x entrypoint.sh
|
|
20 |
EXPOSE 3000
|
21 |
|
22 |
# Create symlink
|
23 |
-
|
24 |
|
25 |
# Start the application
|
26 |
ENTRYPOINT ["/usr/src/app/entrypoint.sh"]
|
|
|
20 |
EXPOSE 3000
|
21 |
|
22 |
# Create symlink
|
23 |
+
RUN mkdir -p ./static/data && ln -s /data/uploads ./static/data/uploads
|
24 |
|
25 |
# Start the application
|
26 |
ENTRYPOINT ["/usr/src/app/entrypoint.sh"]
|
package-lock.json
CHANGED
@@ -16,6 +16,7 @@
|
|
16 |
"@sveltejs/adapter-node": "^1.3.1",
|
17 |
"aws-sdk": "^2.1538.0",
|
18 |
"cookie": "^0.6.0",
|
|
|
19 |
"express": "^4.18.2",
|
20 |
"js-cookie": "^3.0.5",
|
21 |
"svelte-infinite-scroll": "^2.0.1"
|
@@ -3845,6 +3846,11 @@
|
|
3845 |
"node": ">=6"
|
3846 |
}
|
3847 |
},
|
|
|
|
|
|
|
|
|
|
|
3848 |
"node_modules/destroy": {
|
3849 |
"version": "1.2.0",
|
3850 |
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
|
|
|
16 |
"@sveltejs/adapter-node": "^1.3.1",
|
17 |
"aws-sdk": "^2.1538.0",
|
18 |
"cookie": "^0.6.0",
|
19 |
+
"desm": "^1.3.1",
|
20 |
"express": "^4.18.2",
|
21 |
"js-cookie": "^3.0.5",
|
22 |
"svelte-infinite-scroll": "^2.0.1"
|
|
|
3846 |
"node": ">=6"
|
3847 |
}
|
3848 |
},
|
3849 |
+
"node_modules/desm": {
|
3850 |
+
"version": "1.3.1",
|
3851 |
+
"resolved": "https://registry.npmjs.org/desm/-/desm-1.3.1.tgz",
|
3852 |
+
"integrity": "sha512-vgTAOosB1aHrmzjGnzFCbjvXbk8QAOC/36JxJhcBkeAuUy8QwRFxAWBHemiDpUB3cbrBruFUdzpUS21aocvaWg=="
|
3853 |
+
},
|
3854 |
"node_modules/destroy": {
|
3855 |
"version": "1.2.0",
|
3856 |
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
|
package.json
CHANGED
@@ -49,6 +49,7 @@
|
|
49 |
"@sveltejs/adapter-node": "^1.3.1",
|
50 |
"aws-sdk": "^2.1538.0",
|
51 |
"cookie": "^0.6.0",
|
|
|
52 |
"express": "^4.18.2",
|
53 |
"js-cookie": "^3.0.5",
|
54 |
"svelte-infinite-scroll": "^2.0.1"
|
|
|
49 |
"@sveltejs/adapter-node": "^1.3.1",
|
50 |
"aws-sdk": "^2.1538.0",
|
51 |
"cookie": "^0.6.0",
|
52 |
+
"desm": "^1.3.1",
|
53 |
"express": "^4.18.2",
|
54 |
"js-cookie": "^3.0.5",
|
55 |
"svelte-infinite-scroll": "^2.0.1"
|
custom-plugin.ts β plugin.js
RENAMED
@@ -1,12 +1,10 @@
|
|
1 |
import express from 'express';
|
2 |
-
|
3 |
-
const assets = express.static('/data');
|
4 |
const configureServer = (server) => {
|
5 |
server.middlewares.use(assets);
|
6 |
-
}
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
})
|
|
|
1 |
import express from 'express';
|
2 |
+
const assets = express.static(process.env.PUBLIC_FILE_UPLOAD_DIR || 'public');
|
|
|
3 |
const configureServer = (server) => {
|
4 |
server.middlewares.use(assets);
|
5 |
+
};
|
6 |
+
export const myVitePlugin = () => ({
|
7 |
+
name: 'my-vite-plugin',
|
8 |
+
configureServer,
|
9 |
+
configurePreviewServer: configureServer
|
10 |
+
});
|
|
vite.config.ts
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
import { sveltekit } from '@sveltejs/kit/vite';
|
2 |
import { enhancedImages } from '@sveltejs/enhanced-img';
|
3 |
import { defineConfig } from 'vite';
|
4 |
-
import {
|
5 |
|
6 |
export default defineConfig({
|
7 |
plugins: [
|
8 |
enhancedImages(),
|
9 |
sveltekit(),
|
10 |
-
|
11 |
],
|
12 |
server: {
|
13 |
fs: {
|
|
|
1 |
import { sveltekit } from '@sveltejs/kit/vite';
|
2 |
import { enhancedImages } from '@sveltejs/enhanced-img';
|
3 |
import { defineConfig } from 'vite';
|
4 |
+
import { myVitePlugin } from './plugin';
|
5 |
|
6 |
export default defineConfig({
|
7 |
plugins: [
|
8 |
enhancedImages(),
|
9 |
sveltekit(),
|
10 |
+
myVitePlugin(),
|
11 |
],
|
12 |
server: {
|
13 |
fs: {
|