Skip to content

Commit

Permalink
fix: minor fix on vite.config for emotion on importSource
Browse files Browse the repository at this point in the history
  • Loading branch information
panvourtsis committed Jul 17, 2024
1 parent f554484 commit cb9912a
Show file tree
Hide file tree
Showing 3 changed files with 212 additions and 252 deletions.
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@
"@typescript-eslint/parser": "^6.19.1",
"@vitejs/plugin-react": "^4.3.1",
"@vitest/coverage-v8": "^1.6.0",
"eslint": "8.22.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-react": "^7.31.10",
"eslint": "8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-react": "^7.34.4",
"eslint-plugin-react-hooks": "^4.6.0",
"husky": "^8.0.0",
"identity-obj-proxy": "^3.0.0",
"jsdom": "^24.1.0",
"jwt-encode": "^1.0.1",
"lint-staged": "^12.4.1",
"lint-staged": "^15.2.7",
"prettier": "^2.6.2",
"prettier-plugin-organize-imports": "^3.2.2",
"rimraf": "^3.0.2",
Expand All @@ -73,6 +73,7 @@
"tslib": "^2.3.1",
"typedoc": "^0.25.12",
"typescript": "^5.3.3",
"vite": "^5.3.4",
"vite-plugin-dts": "^3.9.1",
"vite-plugin-svgr": "^4.2.0",
"vite-tsconfig-paths": "^4.3.2",
Expand Down
10 changes: 5 additions & 5 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import path from 'path';

import react from '@vitejs/plugin-react';
import { exec } from 'node:child_process';
import { defineConfig, loadEnv } from 'vite';
import { defineConfig, loadEnv, PluginOption } from 'vite';
import dts from 'vite-plugin-dts';
import svgr from 'vite-plugin-svgr';
import tsconfigPaths from 'vite-tsconfig-paths';
Expand All @@ -16,7 +16,7 @@ import pkg from './package.json';
const regexesOfPackages = (externalPackages = []) =>
externalPackages.map((packageName) => new RegExp(`^${packageName}(/.*)?`));

const viteOnBuildSuccess = () => {
const viteOnBuildSuccess = (): PluginOption => {
return {
name: 'vite:on-build-success',
apply: 'build',
Expand All @@ -33,7 +33,6 @@ const plugins = [
react({
babel: {},
jsxImportSource: '@emotion/react',
jsxRuntime: 'classic',
}),
tsconfigPaths(),
svgr(),
Expand All @@ -52,7 +51,7 @@ export default defineConfig(({ mode }) => {

return {
// eslint-disable-next-line @typescript-eslint/naming-convention
publicDir: false,
// publicDir: false,
envPrefix: 'REACT_APP_',
// Define these to keep compatibility with ictinus, toolbox and SSO
define: {
Expand All @@ -67,7 +66,7 @@ export default defineConfig(({ mode }) => {
? {
include: 'src/**',
}
: false,
: null,
lib: {
entry: path.resolve(__dirname, 'src/index.ts'),
name: pkg.name,
Expand All @@ -79,6 +78,7 @@ export default defineConfig(({ mode }) => {
rollupOptions: {
external: [
'react',
'react/jsx-runtime',
'react-dom',
/@emotion\/styled/,
/@emotion\/react/,
Expand Down
Loading

0 comments on commit cb9912a

Please sign in to comment.