fix-svgr-issue-with-tsup (#2429)

This commit is contained in:
bosiraphael
2023-11-10 18:25:14 +01:00
committed by GitHub
parent 032e516a46
commit 73db5eb35d
5 changed files with 31 additions and 6 deletions

View File

@ -127,6 +127,7 @@
"@storybook/react-webpack5": "^7.0.22",
"@storybook/test-runner": "^0.10.0",
"@storybook/testing-library": "^0.1.0",
"@svgr/plugin-jsx": "^8.1.0",
"@svgr/webpack": "^8.0.1",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
@ -151,6 +152,7 @@
"concurrently": "^8.0.1",
"cross-var": "^1.1.0",
"dotenv-cli": "^7.2.1",
"esbuild-plugin-svgr": "^2.1.0",
"eslint": "^8.28.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-standard-with-typescript": "^23.0.0",

View File

@ -6,6 +6,4 @@
<path d="M4 8h3" />
<path d="M4 12h3" />
<path d="M4 16h3" />
</svg>
</svg>

Before

Width:  |  Height:  |  Size: 539 B

After

Width:  |  Height:  |  Size: 536 B

View File

@ -1,4 +1,5 @@
import { defineConfig } from "tsup";
import svgr from 'esbuild-plugin-svgr'
export default defineConfig([
{
@ -9,5 +10,18 @@ export default defineConfig([
dts: true,
clean: true,
outDir: "../docs/src/ui/generated",
esbuildPlugins: [svgr({ template })],
},
]);
]);
function template(variables, { tpl }) {
return tpl`
${variables.imports};
${variables.interfaces};
const ${variables.componentName} = (${variables.props}) => (
${variables.jsx}
);
${variables.exports};
export const ReactComponent = ${variables.componentName};
`;
};

View File

@ -10,4 +10,7 @@ declare module '@emotion/react' {
}
export * from './src/modules/ui/display/checkmark/components/Checkmark';
export * from './src/modules/ui/display/checkmark/components/AnimatedCheckmark'
export * from './src/modules/ui/display/chip/components/Chip'
export * from './src/modules/ui/input/button/components/Button';
export * from './src/modules/ui/display/icon/components/IconAddressBook';

View File

@ -4942,7 +4942,7 @@
"@svgr/babel-plugin-transform-react-native-svg" "^5.4.0"
"@svgr/babel-plugin-transform-svg-component" "^5.5.0"
"@svgr/core@8.1.0":
"@svgr/core@8.1.0", "@svgr/core@^8.0.0":
version "8.1.0"
resolved "https://registry.yarnpkg.com/@svgr/core/-/core-8.1.0.tgz#41146f9b40b1a10beaf5cc4f361a16a3c1885e88"
integrity sha512-8QqtOQT5ACVlmsvKOJNEaWmRPmcojMOzCz4Hs2BGG/toAp/K38LcsMRyLp349glq5AzJbCEeimEoxaX6v/fLrA==
@ -4977,7 +4977,7 @@
dependencies:
"@babel/types" "^7.12.6"
"@svgr/plugin-jsx@8.1.0":
"@svgr/plugin-jsx@8.1.0", "@svgr/plugin-jsx@^8.0.1", "@svgr/plugin-jsx@^8.1.0":
version "8.1.0"
resolved "https://registry.yarnpkg.com/@svgr/plugin-jsx/-/plugin-jsx-8.1.0.tgz#96969f04a24b58b174ee4cd974c60475acbd6928"
integrity sha512-0xiIyBsLlr8quN+WyuxooNW9RJ0Dpr8uOnH/xrCVO8GLUcwHISwj1AG0k+LFzteTkAA0GbX0kj9q6Dk70PTiPA==
@ -9816,6 +9816,14 @@ esbuild-plugin-alias@^0.2.1:
resolved "https://registry.yarnpkg.com/esbuild-plugin-alias/-/esbuild-plugin-alias-0.2.1.tgz#45a86cb941e20e7c2bc68a2bea53562172494fcb"
integrity sha512-jyfL/pwPqaFXyKnj8lP8iLk6Z0m099uXR45aSN8Av1XD4vhvQutxxPzgA2bTcAwQpa1zCXDcWOlhFgyP3GKqhQ==
esbuild-plugin-svgr@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/esbuild-plugin-svgr/-/esbuild-plugin-svgr-2.1.0.tgz#2257d8bbffd15c7830a0afce7e9163e0a8283bd6"
integrity sha512-BKJOlQvXjLipPDPYfX+N6i2tPxSuVOhlg+hEF/nkQwMwFV6IymvuCRO0wLvf9tGyL3mc3yIZ4n9pfxcCx/7v2Q==
dependencies:
"@svgr/core" "^8.0.0"
"@svgr/plugin-jsx" "^8.0.1"
esbuild-register@^3.4.0:
version "3.4.2"
resolved "https://registry.yarnpkg.com/esbuild-register/-/esbuild-register-3.4.2.tgz#1e39ee0a77e8f320a9790e68c64c3559620b9175"