forked from Archives/Athou_commafeed
remove warning about vite not finding custom code at build time
This commit is contained in:
@@ -6,9 +6,6 @@
|
|||||||
<link rel="manifest" href="manifest.json" />
|
<link rel="manifest" href="manifest.json" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="custom_css.css" />
|
|
||||||
<script type="text/javascript" src="custom_js.js"></script>
|
|
||||||
|
|
||||||
<title>CommaFeed</title>
|
<title>CommaFeed</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
import { lingui } from "@lingui/vite-plugin"
|
import { lingui } from "@lingui/vite-plugin"
|
||||||
import react from "@vitejs/plugin-react"
|
import react from "@vitejs/plugin-react"
|
||||||
import { visualizer } from "rollup-plugin-visualizer"
|
import { visualizer } from "rollup-plugin-visualizer"
|
||||||
import { defineConfig } from "vite"
|
import { type PluginOption, defineConfig } from "vite"
|
||||||
import checker from "vite-plugin-checker"
|
import checker from "vite-plugin-checker"
|
||||||
import tsconfigPaths from "vite-tsconfig-paths"
|
import tsconfigPaths from "vite-tsconfig-paths"
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig(() => ({
|
export default defineConfig(() => ({
|
||||||
plugins: [
|
plugins: [
|
||||||
|
customCodeInjector,
|
||||||
react({
|
react({
|
||||||
babel: {
|
babel: {
|
||||||
plugins: ["@lingui/babel-plugin-lingui-macro"],
|
plugins: ["@lingui/babel-plugin-lingui-macro"],
|
||||||
@@ -56,3 +57,30 @@ export default defineConfig(() => ({
|
|||||||
setupFiles: "./src/setupTests.ts",
|
setupFiles: "./src/setupTests.ts",
|
||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
// inject custom js and css links in html
|
||||||
|
const customCodeInjector: PluginOption = {
|
||||||
|
name: "customCodeInjector",
|
||||||
|
transformIndexHtml: html => {
|
||||||
|
return {
|
||||||
|
html,
|
||||||
|
tags: [
|
||||||
|
{
|
||||||
|
tag: "script",
|
||||||
|
attrs: {
|
||||||
|
src: "custom_js.js",
|
||||||
|
},
|
||||||
|
injectTo: "body",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
tag: "link",
|
||||||
|
attrs: {
|
||||||
|
rel: "stylesheet",
|
||||||
|
href: "custom_css.css",
|
||||||
|
},
|
||||||
|
injectTo: "head",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user