@olenbetong/appframe-vite 5.1.42 → 6.0.0
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/lib/build.js +11 -25
- package/lib/index.js +2 -2
- package/package.json +8 -9
package/lib/build.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
3
|
import { visualizer } from "rollup-plugin-visualizer";
|
|
4
|
-
import { viteExternalsPlugin } from "vite-plugin-externals";
|
|
5
4
|
import { importJson } from "./importJson.js";
|
|
6
5
|
export async function addAppframeBuildConfig(config) {
|
|
7
6
|
let appPkg = await importJson("./package.json", true);
|
|
@@ -13,12 +12,6 @@ export async function addAppframeBuildConfig(config) {
|
|
|
13
12
|
sourcemap: true,
|
|
14
13
|
};
|
|
15
14
|
config.plugins = config.plugins ?? [];
|
|
16
|
-
if (appframe.build.externals !== false) {
|
|
17
|
-
config.plugins.push(viteExternalsPlugin({
|
|
18
|
-
react: "React",
|
|
19
|
-
"react-dom": "ReactDOM",
|
|
20
|
-
}));
|
|
21
|
-
}
|
|
22
15
|
let entry = resolve(process.cwd(), "./src/index.tsx");
|
|
23
16
|
if (!existsSync(resolve(entry))) {
|
|
24
17
|
entry = resolve(process.cwd(), "./src/index.ts");
|
|
@@ -26,10 +19,12 @@ export async function addAppframeBuildConfig(config) {
|
|
|
26
19
|
if (!existsSync(resolve(entry))) {
|
|
27
20
|
entry = resolve(process.cwd(), "./src/index.js");
|
|
28
21
|
}
|
|
29
|
-
config.
|
|
30
|
-
|
|
22
|
+
config.appType = "custom";
|
|
23
|
+
config.build.rolldownOptions = {
|
|
24
|
+
input: { main: entry },
|
|
31
25
|
// Cast visualizer plugin to any to avoid Rollup type version clashes
|
|
32
26
|
plugins: [visualizer({ filename: "./dist/stats.html", gzipSize: true })],
|
|
27
|
+
external: appframe.build.externals !== false ? ["react", "react-dom", "react-dom/client"] : [],
|
|
33
28
|
output: {
|
|
34
29
|
globals: appframe.build.externals !== false
|
|
35
30
|
? {
|
|
@@ -38,22 +33,13 @@ export async function addAppframeBuildConfig(config) {
|
|
|
38
33
|
"react-dom/client": "ReactDOM",
|
|
39
34
|
}
|
|
40
35
|
: {},
|
|
41
|
-
entryFileNames:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
return `file/article/script/${appframe.article.id}/[name].[hash].chunk.min.js`;
|
|
50
|
-
},
|
|
51
|
-
assetFileNames: (assetInfo) => {
|
|
52
|
-
if (assetInfo.name?.endsWith(".css")) {
|
|
53
|
-
return `file/article/style/${appframe.article.id}/[name].[hash].min.css`;
|
|
54
|
-
}
|
|
55
|
-
return assetInfo.name ?? "unnamed";
|
|
56
|
-
},
|
|
36
|
+
entryFileNames: `file/article/script/${appframe.article.id}/main.[hash].min.js`,
|
|
37
|
+
chunkFileNames: (chunkInfo) => chunkInfo.name === "main"
|
|
38
|
+
? `file/article/script/${appframe.article.id}/[name].[hash].min.js`
|
|
39
|
+
: `file/article/script/${appframe.article.id}/[name].[hash].chunk.min.js`,
|
|
40
|
+
assetFileNames: (assetInfo) => assetInfo.name?.endsWith(".css")
|
|
41
|
+
? `file/article/style/${appframe.article.id}/[name].[hash].min.css`
|
|
42
|
+
: (assetInfo.name ?? "unnamed"),
|
|
57
43
|
},
|
|
58
44
|
};
|
|
59
45
|
return config;
|
package/lib/index.js
CHANGED
|
@@ -56,8 +56,8 @@ export default function appframe() {
|
|
|
56
56
|
build: {
|
|
57
57
|
...currentConfig.build,
|
|
58
58
|
target: currentConfig.build?.target ?? ["chrome90", "safari14"],
|
|
59
|
-
|
|
60
|
-
...currentConfig.build?.
|
|
59
|
+
rolldownOptions: {
|
|
60
|
+
...currentConfig.build?.rolldownOptions,
|
|
61
61
|
output: {
|
|
62
62
|
assetFileNames: (assetInfo) => {
|
|
63
63
|
if (assetInfo.name === "style.css")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olenbetong/appframe-vite",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "Tools to use and deploy Vite applications to Appframe",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -22,27 +22,26 @@
|
|
|
22
22
|
"author": "Bjørnar Vister Hansen <bvh@olenbetong.no>",
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"body-parser": "^2.2.
|
|
25
|
+
"body-parser": "^2.2.2",
|
|
26
26
|
"chalk": "^5.4.1",
|
|
27
|
-
"chokidar": "^
|
|
28
|
-
"dotenv": "^
|
|
27
|
+
"chokidar": "^5.0.0",
|
|
28
|
+
"dotenv": "^17.2.3",
|
|
29
29
|
"jsdom": "27.4.0",
|
|
30
|
-
"rollup-plugin-visualizer": "^
|
|
31
|
-
"vite-plugin-externals": "^0.6.2",
|
|
30
|
+
"rollup-plugin-visualizer": "^6.0.5",
|
|
32
31
|
"@olenbetong/appframe-data": "1.3.0"
|
|
33
32
|
},
|
|
34
33
|
"devDependencies": {
|
|
35
|
-
"@types/jsdom": "^
|
|
34
|
+
"@types/jsdom": "^27.0.0",
|
|
36
35
|
"@types/node": "25.0.9",
|
|
37
36
|
"typescript": "^5.9.3",
|
|
38
|
-
"vite": "
|
|
37
|
+
"vite": "8.0.0-beta.0"
|
|
39
38
|
},
|
|
40
39
|
"peerDependencies": {
|
|
41
40
|
"vite": ">=5.0.0"
|
|
42
41
|
},
|
|
43
42
|
"optionalDependencies": {
|
|
44
43
|
"@types/tcp-port-used": "^1.0.4",
|
|
45
|
-
"open": "^
|
|
44
|
+
"open": "^11.0.0",
|
|
46
45
|
"tcp-port-used": "^1.0.2"
|
|
47
46
|
},
|
|
48
47
|
"gitHead": "ef3839cfde6097aa12488f72913680b3ce22706e",
|