Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • coscine/frontend/apps/ui
1 result
Select Git revision
Show changes
import type { ComponentResolver } from "unplugin-vue-components/types";
/**
* Resolver for BootstrapVue
*
* @link https://github.com/bootstrap-vue/bootstrap-vue
*/
export function BootstrapVueResolver(): ComponentResolver {
return {
type: "component",
resolve: (name: string) => {
if (name.match(/^B[A-Z]/)) return { name, from: "bootstrap-vue" };
},
};
}
import path from "path";
import { defineConfig } from "vite";
import { createVuePlugin } from "vite-plugin-vue2";
// Polyfills for including streams
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill';
import { NodeModulesPolyfillPlugin } from '@esbuild-plugins/node-modules-polyfill';
import nodePolyfills from 'rollup-plugin-polyfill-node';
import globalPolyfills from 'rollup-plugin-node-globals';
import replace from '@rollup/plugin-replace';
import WindiCSS from "vite-plugin-windicss";
import Components from "unplugin-vue-components/vite";
import { BootstrapVueResolver } from "./src/util/bootstrap-vue-resolver";
const config = defineConfig({
resolve: {
alias: {
......@@ -24,16 +34,23 @@ const config = defineConfig({
dedupe: ["vue-demi"],
},
// Node.js global to browser globalThis
define: {
'process.env': process.env
'process.env': process.env,
'global': 'globalThis',
},
optimizeDeps: {
esbuildOptions: {
// Node.js global to browser globalThis
define: {
global: 'globalThis'
},
// Enable esbuild polyfill plugins
plugins: [
NodeGlobalsPolyfillPlugin({
crypto: true,
process: true,
buffer: true
}),
NodeModulesPolyfillPlugin(),
],
},
},
......@@ -43,13 +60,49 @@ const config = defineConfig({
external: [ ],
output: {
manualChunks: {
"vuelidate": ["vuelidate"],
"vuelidate/lib/validators": [
"vuelidate/lib/validators",
],
"bootstrap-vue": ["bootstrap-vue"],
"@coscine/form-generator": ["@coscine/form-generator"],
},
},
plugins: [
// Enable rollup polyfills plugin
// used during production bundling
nodePolyfills(),
globalPolyfills(),
replace({
values: {
// Fixes for rdf-parse
'rdfParse.RdfParser': 'RdfParser',
'ly.RdfParser': 'RdfParser',
"Duplex.prototype.push": "_stream_readable.prototype.push",
"_stream_readable$1": "_stream_readable",
"_stream_readable$2": "_stream_readable",
"Readable$3.call": "Readable$2.call",
'return new Readable$2(options);':
`{
Object.assign(this, EventEmitter.prototype);
this.push = Readable$1.prototype.push;
this.unshift = Readable$1.prototype.unshift;
this.isPaused = Readable$1.prototype.isPaused;
this.setEncoding = Readable$1.prototype.setEncoding;
this.read = Readable$1.prototype.read;
this.pipe = Readable$1.prototype.pipe;
this.unpipe = Readable$1.prototype.unpipe;
this.on = Readable$1.prototype.on;
this.addListener = Readable$1.prototype.addListener;
this.resume = Readable$1.prototype.resume;
this.pause = Readable$1.prototype.pause;
this.wrap = Readable$1.prototype.wrap;
this.push = Transform$2.prototype.push;
this._read = Transform$2.prototype._read;
this._destroy = Transform$2.prototype._destroy;
}`
},
delimiters: ['', ''],
preventAssignment: false,
}),
],
},
},
......@@ -60,6 +113,9 @@ const config = defineConfig({
dts: 'src/components.d.ts',
include: [/\.vue$/, /\.vue\?vue/],
exclude: [/[\\/]node_modules[\\/]/, /[\\/]\.git[\\/]/, /[\\/]\.nuxt[\\/]/],
resolvers: [
BootstrapVueResolver()
],
}),
],
......
This diff is collapsed.