Files
opencloud/vendor/github.com/libregraph/lico/identifier/vite.config.js
dependabot[bot] e08899d224 chore(deps): bump github.com/libregraph/lico from 0.64.0 to 0.65.0
Bumps [github.com/libregraph/lico](https://github.com/libregraph/lico) from 0.64.0 to 0.65.0.
- [Changelog](https://github.com/libregraph/lico/blob/master/CHANGELOG.md)
- [Commits](https://github.com/libregraph/lico/compare/v0.64.0...v0.65.0)

---
updated-dependencies:
- dependency-name: github.com/libregraph/lico
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-04 09:19:55 +01:00

71 lines
1.7 KiB
JavaScript

import { defineConfig, splitVendorChunkPlugin } from "vite";
import react from "@vitejs/plugin-react";
import checker from "vite-plugin-checker";
import legacy from "@vitejs/plugin-legacy";
const addScriptCSPNoncePlaceholderPlugin = () => {
return {
name: "add-script-nonce-placeholderP-plugin",
apply: "build",
transformIndexHtml: {
order: "post",
handler(htmlData) {
return htmlData.replaceAll(
/<script nomodule>/gi,
`<script nomodule nonce="__CSP_NONCE__">`
).replaceAll(
/<script type="module">/gi,
`<script type="module" nonce="__CSP_NONCE__">`
).replaceAll(
/<script nomodule crossorigin id="vite-legacy-entry"/gi,
`<script nomodule crossorigin id="vite-legacy-entry" nonce="__CSP_NONCE__"`
);
},
},
};
};
export default defineConfig((env) => {
return {
build: {
outDir: 'build',
assetsDir: 'static/assets',
manifest: 'asset-manifest.json',
sourcemap: true,
},
base: './',
server: {
port: 3001,
strictPort: true,
host: '127.0.0.1',
hmr: {
protocol: 'ws',
host: '127.0.0.1',
clientPort: 3001,
},
},
plugins: [
react(),
legacy({
targets: ['edge 18'],
}),
env.mode !== "test" &&
checker({
typescript: true,
eslint: {
lintCommand: 'eslint --max-warnings=0 src',
},
}),
splitVendorChunkPlugin(),
addScriptCSPNoncePlaceholderPlugin(),
],
test: {
globals: true,
environment: 'jsdom',
setupFiles: './tests/setup.js',
},
};
});