aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package-lock.json72
-rw-r--r--package.json1
-rw-r--r--vite.config.ts130
3 files changed, 150 insertions, 53 deletions
diff --git a/package-lock.json b/package-lock.json
index 0f68ce3..ca5ce53 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -111,6 +111,7 @@
"vite": "^6.3.5",
"vite-plugin-eslint": "^1.8.1",
"vite-plugin-raw": "^1.0.3",
+ "vite-plugin-static-copy": "^3.1.0",
"vue": "^3.5.13",
"vue-dragscroll": "^4.0.6",
"vue-loader": "^17.4.2",
@@ -12959,6 +12960,19 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/p-map": {
+ "version": "7.0.3",
+ "resolved": "https://registry.npmjs.org/p-map/-/p-map-7.0.3.tgz",
+ "integrity": "sha512-VkndIv2fIB99swvQoA65bm+fsmt6UNdGeIB0oxBs+WhAhdh08QA04JXpI7rbB9r08/nkbysKoya9rtDERYOYMA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/p-try": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
@@ -16705,6 +16719,64 @@
"dev": true,
"license": "ISC"
},
+ "node_modules/vite-plugin-static-copy": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/vite-plugin-static-copy/-/vite-plugin-static-copy-3.1.0.tgz",
+ "integrity": "sha512-ONFBaYoN1qIiCxMCfeHI96lqLza7ujx/QClIXp4kEULUbyH2qLgYoaL8JHhk3FWjSB4TpzoaN3iMCyCFldyXzw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "chokidar": "^3.5.3",
+ "fs-extra": "^11.3.0",
+ "p-map": "^7.0.3",
+ "picocolors": "^1.1.1",
+ "tinyglobby": "^0.2.14"
+ },
+ "engines": {
+ "node": "^18.0.0 || >=20.0.0"
+ },
+ "peerDependencies": {
+ "vite": "^5.0.0 || ^6.0.0 || ^7.0.0"
+ }
+ },
+ "node_modules/vite-plugin-static-copy/node_modules/fs-extra": {
+ "version": "11.3.0",
+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.0.tgz",
+ "integrity": "sha512-Z4XaCL6dUDHfP/jT25jJKMmtxvuwbkrD1vNSMFlo9lNLY2c5FHYSQgHPRZUjAB26TpDEoW9HCOgplrdbaPV/ew==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "graceful-fs": "^4.2.0",
+ "jsonfile": "^6.0.1",
+ "universalify": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=14.14"
+ }
+ },
+ "node_modules/vite-plugin-static-copy/node_modules/jsonfile": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
+ "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "universalify": "^2.0.0"
+ },
+ "optionalDependencies": {
+ "graceful-fs": "^4.1.6"
+ }
+ },
+ "node_modules/vite-plugin-static-copy/node_modules/universalify": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz",
+ "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 10.0.0"
+ }
+ },
"node_modules/vite/node_modules/fdir": {
"version": "6.4.6",
"resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.6.tgz",
diff --git a/package.json b/package.json
index b1236c4..c4da709 100644
--- a/package.json
+++ b/package.json
@@ -123,6 +123,7 @@
"vite": "^6.3.5",
"vite-plugin-eslint": "^1.8.1",
"vite-plugin-raw": "^1.0.3",
+ "vite-plugin-static-copy": "^3.1.0",
"vue": "^3.5.13",
"vue-dragscroll": "^4.0.6",
"vue-loader": "^17.4.2",
diff --git a/vite.config.ts b/vite.config.ts
index d53d630..b37dade 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -2,64 +2,88 @@ import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import path from 'path';
import rawPlugin from 'vite-plugin-raw';
+import { viteStaticCopy } from 'vite-plugin-static-copy';
-export default defineConfig(({ mode }) => {
- return {
- plugins: [
- vue({
- template: {
- compilerOptions: {
- isCustomElement: tag => ['altcha-widget'].includes(tag)
- }
+export default defineConfig(({ mode }) => ({
+ plugins: [
+ vue({
+ template: {
+ compilerOptions: {
+ isCustomElement: tag => ['altcha-widget'].includes(tag)
}
- }),
- rawPlugin({
- match: /ckeditor5-[^/\\]+[/\\]theme[/\\]icons[/\\][^/\\]+\.svg$/,
- exclude: undefined
- })
- ],
- resolve: {
- alias: {
- '@': path.resolve(__dirname, 'resources'),
- 'jquery-ui': 'jquery-ui'
}
- },
- build: {
- outDir: 'public/assets',
- emptyOutDir: false,
- rollupOptions: {
- input: {
- 'studip-base': path.resolve(__dirname, 'resources/assets/javascripts/entry-base.js'),
- 'studip-statusgroups': path.resolve(__dirname, 'resources/assets/javascripts/entry-statusgroups.js'),
- 'studip-wysiwyg': path.resolve(__dirname, 'resources/assets/javascripts/entry-wysiwyg.js'),
- 'studip-installer': path.resolve(__dirname, 'resources/assets/javascripts/entry-installer.js'),
- 'print': path.resolve(__dirname, 'resources/assets/stylesheets/print.scss'),
- 'accessibility': path.resolve(__dirname, 'resources/assets/stylesheets/highcontrast.scss')
+ }),
+ rawPlugin({
+ match: /ckeditor5-[^/\\]+[\\/]+theme[\\/]+icons[\\/]+[^/\\]+\.svg$/,
+ exclude: /.*/
+ }),
+ viteStaticCopy({
+ targets: [
+ {
+ src: 'node_modules/vue/dist/vue.global.prod.js',
+ dest: 'javascripts'
},
- external: ['vue', 'vuex'],
- output: {
- entryFileNames: info => info.name.includes('entry-') ? 'javascripts/[name].js' : 'stylesheets/[name].js',
- chunkFileNames: 'javascripts/[name].chunk.js?h=[hash]',
- assetFileNames: assetInfo => {
- if (assetInfo.name?.endsWith('.css')) {
- return 'stylesheets/[name][extname]';
- }
- return '[name][extname]';
- }
+ {
+ src: 'node_modules/vuex/dist/vuex.global.prod.js',
+ dest: 'javascripts'
}
+ ]
+ })
+ ],
+ resolve: {
+ alias: {
+ '@': path.resolve(__dirname, 'resources'),
+ 'jquery-ui': 'jquery-ui'
+ }
+ },
+ publicDir: false,
+ build: {
+ outDir: 'public/assets',
+ emptyOutDir: false,
+ sourcemap: mode !== 'production',
+ rollupOptions: {
+ input: {
+ 'studip-base': path.resolve(__dirname, 'resources/assets/javascripts/entry-base.js'),
+ 'studip-statusgroups': path.resolve(__dirname, 'resources/assets/javascripts/entry-statusgroups.js'),
+ 'studip-wysiwyg': path.resolve(__dirname, 'resources/assets/javascripts/entry-wysiwyg.js'),
+ 'studip-installer': path.resolve(__dirname, 'resources/assets/javascripts/entry-installer.js'),
+ 'print': path.resolve(__dirname, 'resources/assets/stylesheets/print.scss'),
+ 'accessibility': path.resolve(__dirname, 'resources/assets/stylesheets/highcontrast.scss')
},
- sourcemap: mode !== 'production'
- },
- css: {
- postcss: './postcss.config.js',
- preprocessorOptions: {
- scss: {}
+ external: ['vue', 'vuex'],
+ output: {
+ format: 'iife',
+ entryFileNames: 'javascripts/[name].js',
+ chunkFileNames: 'javascripts/[name].chunk.js?h=[hash]',
+ assetFileNames: assetInfo => {
+ const name = assetInfo.name || '';
+ if (name.endsWith('.css')) {
+ return 'stylesheets/[name][extname]';
+ }
+ if (/\.(woff2?|ttf|eot)$/.test(name)) {
+ return 'fonts/[name][extname]';
+ }
+ if (/\.(png|jpe?g|svg|gif|webp)$/.test(name)) {
+ return 'images/[name][extname]';
+ }
+ return 'javascripts/[name][extname]';
+ },
+ globals: {
+ vue: 'Vue',
+ vuex: 'Vuex'
+ }
}
- },
- define: {
- __VUE_OPTIONS_API__: true,
- __VUE_PROD_DEVTOOLS__: mode !== 'production',
- __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: mode !== 'production'
}
- };
-});
+ },
+ css: {
+ postcss: './postcss.config.js',
+ preprocessorOptions: {
+ scss: {}
+ }
+ },
+ define: {
+ __VUE_OPTIONS_API__: true,
+ __VUE_PROD_DEVTOOLS__: mode !== 'production',
+ __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: mode !== 'production'
+ }
+}));