@vendure/dashboard 3.3.4-master-202506181504 → 3.3.4-master-202506181834
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.
|
@@ -2,16 +2,36 @@ import path from 'path';
|
|
|
2
2
|
export function viteConfigPlugin({ packageRoot }) {
|
|
3
3
|
return {
|
|
4
4
|
name: 'vendure:vite-config-plugin',
|
|
5
|
-
config: (config) => {
|
|
6
|
-
var _a, _b, _c, _d;
|
|
5
|
+
config: (config, env) => {
|
|
6
|
+
var _a, _b, _c, _d, _e;
|
|
7
|
+
// Only set the vite `root` to the dashboard package when running the dev server.
|
|
8
|
+
// During a production build we still need to reference the dashboard source which
|
|
9
|
+
// lives in `node_modules`, but we don't want the build output to be emitted in there.
|
|
10
|
+
// Therefore we set `root` only for `serve` and, for `build`, we instead make sure that
|
|
11
|
+
// an `outDir` **outside** of `node_modules` is used (defaulting to the current working
|
|
12
|
+
// directory if the user did not provide one already).
|
|
7
13
|
config.root = packageRoot;
|
|
14
|
+
// If we are building and no explicit outDir has been provided (or it is a relative path),
|
|
15
|
+
// set it to an **absolute** path relative to the cwd so that the output never ends up in
|
|
16
|
+
// `node_modules`.
|
|
17
|
+
if (env.command === 'build') {
|
|
18
|
+
const buildConfig = (_a = config.build) !== null && _a !== void 0 ? _a : {};
|
|
19
|
+
const hasOutDir = typeof buildConfig.outDir === 'string' && buildConfig.outDir.length > 0;
|
|
20
|
+
const outDirIsAbsolute = hasOutDir && path.isAbsolute(buildConfig.outDir);
|
|
21
|
+
const normalizedOutDir = hasOutDir
|
|
22
|
+
? outDirIsAbsolute
|
|
23
|
+
? buildConfig.outDir
|
|
24
|
+
: path.resolve(process.cwd(), buildConfig.outDir)
|
|
25
|
+
: path.resolve(process.cwd(), 'dist/vendure-dashboard');
|
|
26
|
+
config.build = Object.assign(Object.assign({}, buildConfig), { outDir: normalizedOutDir });
|
|
27
|
+
}
|
|
8
28
|
config.resolve = {
|
|
9
|
-
alias: Object.assign(Object.assign({}, ((
|
|
29
|
+
alias: Object.assign(Object.assign({}, ((_c = (_b = config.resolve) === null || _b === void 0 ? void 0 : _b.alias) !== null && _c !== void 0 ? _c : {})), { '@': path.resolve(packageRoot, './src/lib') }),
|
|
10
30
|
};
|
|
11
31
|
// This is required to prevent Vite from pre-bundling the
|
|
12
32
|
// dashboard source when it resides in node_modules.
|
|
13
33
|
config.optimizeDeps = Object.assign(Object.assign({}, config.optimizeDeps), { exclude: [
|
|
14
|
-
...(((
|
|
34
|
+
...(((_d = config.optimizeDeps) === null || _d === void 0 ? void 0 : _d.exclude) || []),
|
|
15
35
|
'@vendure/dashboard',
|
|
16
36
|
'@/providers',
|
|
17
37
|
'@/framework',
|
|
@@ -26,7 +46,7 @@ export function viteConfigPlugin({ packageRoot }) {
|
|
|
26
46
|
// on lodash which is a CJS packages and _does_ require
|
|
27
47
|
// pre-bundling.
|
|
28
48
|
include: [
|
|
29
|
-
...(((
|
|
49
|
+
...(((_e = config.optimizeDeps) === null || _e === void 0 ? void 0 : _e.include) || []),
|
|
30
50
|
'@/components > recharts',
|
|
31
51
|
'@/components > react-dropzone',
|
|
32
52
|
] });
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vendure/dashboard",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "3.3.4-master-
|
|
4
|
+
"version": "3.3.4-master-202506181834",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -86,8 +86,8 @@
|
|
|
86
86
|
"@types/react-dom": "^19.0.4",
|
|
87
87
|
"@types/react-grid-layout": "^1.3.5",
|
|
88
88
|
"@uidotdev/usehooks": "^2.4.1",
|
|
89
|
-
"@vendure/common": "^3.3.4-master-
|
|
90
|
-
"@vendure/core": "^3.3.4-master-
|
|
89
|
+
"@vendure/common": "^3.3.4-master-202506181834",
|
|
90
|
+
"@vendure/core": "^3.3.4-master-202506181834",
|
|
91
91
|
"@vitejs/plugin-react": "^4.3.4",
|
|
92
92
|
"awesome-graphql-client": "^2.1.0",
|
|
93
93
|
"class-variance-authority": "^0.7.1",
|
|
@@ -130,5 +130,5 @@
|
|
|
130
130
|
"lightningcss-linux-arm64-musl": "^1.29.3",
|
|
131
131
|
"lightningcss-linux-x64-musl": "^1.29.1"
|
|
132
132
|
},
|
|
133
|
-
"gitHead": "
|
|
133
|
+
"gitHead": "78db619a3a32108f73408c0e8ecc1846c78529a0"
|
|
134
134
|
}
|
|
@@ -1,11 +1,39 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
|
-
import { Plugin, UserConfig } from 'vite';
|
|
2
|
+
import { ConfigEnv, Plugin, UserConfig } from 'vite';
|
|
3
3
|
|
|
4
4
|
export function viteConfigPlugin({ packageRoot }: { packageRoot: string }): Plugin {
|
|
5
5
|
return {
|
|
6
6
|
name: 'vendure:vite-config-plugin',
|
|
7
|
-
config: (config: UserConfig) => {
|
|
7
|
+
config: (config: UserConfig, env: ConfigEnv) => {
|
|
8
|
+
// Only set the vite `root` to the dashboard package when running the dev server.
|
|
9
|
+
// During a production build we still need to reference the dashboard source which
|
|
10
|
+
// lives in `node_modules`, but we don't want the build output to be emitted in there.
|
|
11
|
+
// Therefore we set `root` only for `serve` and, for `build`, we instead make sure that
|
|
12
|
+
// an `outDir` **outside** of `node_modules` is used (defaulting to the current working
|
|
13
|
+
// directory if the user did not provide one already).
|
|
8
14
|
config.root = packageRoot;
|
|
15
|
+
|
|
16
|
+
// If we are building and no explicit outDir has been provided (or it is a relative path),
|
|
17
|
+
// set it to an **absolute** path relative to the cwd so that the output never ends up in
|
|
18
|
+
// `node_modules`.
|
|
19
|
+
if (env.command === 'build') {
|
|
20
|
+
const buildConfig = config.build ?? {};
|
|
21
|
+
|
|
22
|
+
const hasOutDir = typeof buildConfig.outDir === 'string' && buildConfig.outDir.length > 0;
|
|
23
|
+
const outDirIsAbsolute = hasOutDir && path.isAbsolute(buildConfig.outDir as string);
|
|
24
|
+
|
|
25
|
+
const normalizedOutDir = hasOutDir
|
|
26
|
+
? outDirIsAbsolute
|
|
27
|
+
? (buildConfig.outDir as string)
|
|
28
|
+
: path.resolve(process.cwd(), buildConfig.outDir as string)
|
|
29
|
+
: path.resolve(process.cwd(), 'dist/vendure-dashboard');
|
|
30
|
+
|
|
31
|
+
config.build = {
|
|
32
|
+
...buildConfig,
|
|
33
|
+
outDir: normalizedOutDir,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
9
37
|
config.resolve = {
|
|
10
38
|
alias: {
|
|
11
39
|
...(config.resolve?.alias ?? {}),
|