mirror of
https://github.com/cinnyapp/cinny.git
synced 2024-12-29 10:56:10 +00:00
Remove svg loader as available in Vite by default (#1728)
This commit is contained in:
parent
565a6563e1
commit
5259f11679
10
package-lock.json
generated
10
package-lock.json
generated
|
@ -88,7 +88,6 @@
|
|||
"eslint-plugin-jsx-a11y": "6.6.1",
|
||||
"eslint-plugin-react": "7.31.11",
|
||||
"eslint-plugin-react-hooks": "4.6.0",
|
||||
"mini-svg-data-uri": "1.4.4",
|
||||
"prettier": "2.8.1",
|
||||
"sass": "1.56.2",
|
||||
"typescript": "4.9.4",
|
||||
|
@ -6643,15 +6642,6 @@
|
|||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/mini-svg-data-uri": {
|
||||
"version": "1.4.4",
|
||||
"resolved": "https://registry.npmjs.org/mini-svg-data-uri/-/mini-svg-data-uri-1.4.4.tgz",
|
||||
"integrity": "sha512-r9deDe9p5FJUPZAk3A59wGH7Ii9YrjjWw0jmw/liSbHl2CHiyXj6FcDXDu2K3TjVAXqiJdaw3xxwlZZr9E6nHg==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"mini-svg-data-uri": "cli.js"
|
||||
}
|
||||
},
|
||||
"node_modules/minimatch": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
||||
|
|
|
@ -98,7 +98,6 @@
|
|||
"eslint-plugin-jsx-a11y": "6.6.1",
|
||||
"eslint-plugin-react": "7.31.11",
|
||||
"eslint-plugin-react-hooks": "4.6.0",
|
||||
"mini-svg-data-uri": "1.4.4",
|
||||
"prettier": "2.8.1",
|
||||
"sass": "1.56.2",
|
||||
"typescript": "4.9.4",
|
||||
|
|
|
@ -6,7 +6,6 @@ import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';
|
|||
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill';
|
||||
import inject from '@rollup/plugin-inject';
|
||||
import topLevelAwait from 'vite-plugin-top-level-await';
|
||||
import { svgLoader } from './viteSvgLoader';
|
||||
import buildConfig from './build.config';
|
||||
|
||||
const copyFiles = {
|
||||
|
@ -55,7 +54,6 @@ export default defineConfig({
|
|||
}),
|
||||
viteStaticCopy(copyFiles),
|
||||
vanillaExtractPlugin(),
|
||||
svgLoader(),
|
||||
wasm(),
|
||||
react(),
|
||||
],
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
import svgToMiniDataURI from 'mini-svg-data-uri';
|
||||
import type { Plugin } from 'rollup';
|
||||
import fs from 'fs';
|
||||
|
||||
// TODO: remove this once https://github.com/vitejs/vite/pull/2909 gets merged
|
||||
export const svgLoader = (): Plugin => ({
|
||||
name: 'vite-svg-patch-plugin',
|
||||
transform: (code, id) => {
|
||||
if (id.endsWith('.svg')) {
|
||||
const extractedSvg = fs.readFileSync(id, 'utf8');
|
||||
const datauri = svgToMiniDataURI.toSrcset(extractedSvg);
|
||||
return `export default "${datauri}"`;
|
||||
}
|
||||
return code;
|
||||
},
|
||||
});
|
Loading…
Reference in a new issue