dextuploadx5-vue-vite
v0.0.1
Published
Vite helper for dextuploadx5-vue (copies DX5 static resources)
Maintainers
Readme
DEXTUploadX5 Vue Vite Helper
Vite helper package for dextuploadx5-vue.
dextuploadx5-vue requires the DX5 static files to be available at the runtime
productPath.
This package automates that setup in Vite projects. During development or
production builds, it copies the DX5 files from dextuploadx5-vue/dist/dx5 to
the Vite public directory or another target directory. During development, it
also serves copied DX5 files from the configured DX5 mount path.
The helper always excludes dextuploadx5-configuration.js from the copied files.
Features
- Exposes
withDEXTUploadX5()for Vite projects - Copies DX5 static files automatically during
viteandvite build - Serves copied DX5 static files during
vitedevelopment - Uses the Vite
publicDirby default - Supports custom target directories
- Excludes
dextuploadx5-configuration.jsfrom the copied result
Requirements
- Vite 5 or later
[email protected]or later- DEXTUploadX5
4.5.0.0(beta)or later throughdextuploadx5-vue
Installation
npm install dextuploadx5-vue
npm install -D dextuploadx5-vue-vite viteInstall dextuploadx5-vue-vite as a devDependency because it is used in the
Vite build configuration, not in browser runtime code.
Quick Start
import vue from "@vitejs/plugin-vue";
import { defineConfig } from "vite";
import { withDEXTUploadX5 } from "dextuploadx5-vue-vite";
export default defineConfig({
plugins: [
vue(),
...withDEXTUploadX5()
]
});With this configuration, DX5 files are copied to public/dx5 by default, so
dextuploadx5-vue can load them with productPath: "/dx5/".
API
withDEXTUploadX5(options?)
Returns the Vite plugins required to copy and serve DX5 files for both development and production build.
plugins: [
vue(),
...withDEXTUploadX5(options)
]dextuploadx5VueVite(options?)
Returns the development-only Vite plugin. It copies DX5 files and serves
requests under /<dx5DirName>/*.
dextuploadx5VueViteBuild(options?)
Returns the build-only Vite plugin. It copies DX5 files before production build output is generated.
Options
from?: string
Source DX5 directory.
- Default:
node_modules/dextuploadx5-vue/dist/dx5
publicDir?: string
Public directory root to copy into.
- Default: current Vite
publicDir
When set, the helper copies files to publicDir/<dx5DirName>.
to?: string
Exact target directory path, resolved from the Vite project root.
When set, this value is used directly and publicDir/dx5DirName are ignored.
dx5DirName?: string
Subdirectory name used under publicDir and as the development server mount
path.
- Default:
"dx5" - With the default value, development requests to
/dx5/*are served from the copied directory
verbose?: boolean
Controls copy logging.
- Default:
true
Typical Usage
Copy into the default Vite public directory
plugins: [
vue(),
...withDEXTUploadX5()
]This copies DX5 files into the active Vite publicDir under dx5.
Copy into public/custom-dx5
plugins: [
vue(),
...withDEXTUploadX5({
dx5DirName: "custom-dx5"
})
]With this option, configure dextuploadx5-vue with
productPath: "/custom-dx5/".
Copy into a specific directory
plugins: [
vue(),
...withDEXTUploadX5({
to: "../shared-static/dx5"
})
]The to path is resolved from the Vite project root. Use this when your project
serves static files from a directory that is not the active Vite publicDir.
Notes
- This package is a build-time helper. It does not replace
dextuploadx5-vue. - DX5 files are resolved from the installed
dextuploadx5-vuepackage first. - If
dextuploadx5-vuecannot be resolved automatically, the helper falls back toprocess.cwd()/node_modules/dextuploadx5-vue/dist/dx5. dextuploadx5-configuration.jsis never copied and is removed from the target path if it already exists.- The purpose of this package is to remove the need to manage DX5 static file copying manually in Vite projects.
- DEXTUploadX5 itself is not distributed through npm, so its required version is documented here instead of
package.json.
Compatibility
| dextuploadx5-vue-vite | Minimum dextuploadx5-vue | Minimum DEXTUploadX5 version |
| --- | --- | --- |
| 0.0.1 | 0.0.1 | 4.5.0.0(beta) |
History
0.0.1
- Initial package release
License
This package is free to use, including commercial use. Modification for internal use is allowed. Redistribution of modified versions is prohibited. DEXTUploadX5 itself is a commercial product and is not free to use under the same terms as DEXTUploadX5 Vue Vite Helper.
See the LICENSE file for full terms.
