From 908a62cf60801157dcf9c2f2b03a6939dfb438aa Mon Sep 17 00:00:00 2001 From: Emmanuel Krebs Date: Sun, 22 Sep 2024 16:03:28 +0200 Subject: [PATCH] tentative fix --- .ladle/vite.config.js | 62 +++++++++++++------------------------------ pocstcss.config.js | 6 +++++ 2 files changed, 24 insertions(+), 44 deletions(-) create mode 100644 pocstcss.config.js diff --git a/.ladle/vite.config.js b/.ladle/vite.config.js index e174682..54c1a2d 100644 --- a/.ladle/vite.config.js +++ b/.ladle/vite.config.js @@ -1,54 +1,28 @@ import react from '@vitejs/plugin-react'; -import fs from 'fs'; import { resolve } from 'path'; import tailwindcss from 'tailwindcss'; import { defineConfig } from 'vite'; import dts from 'vite-plugin-dts'; -function inlineSvg(...paths) { - return { - name: 'inline-svg', - transformIndexHtml: { - enforce: 'pre', - transform: (html) => { - if (!Array.isArray(paths) || paths.length <= 0) return html; - - let newHtml = html; - paths.forEach((svg) => { - const extractedSvg = fs.readFileSync(svg, 'utf8'); - newHtml = newHtml.replace('', `${extractedSvg}`); - }); - return newHtml; - }, +export default defineConfig({ + server: { open: false }, + plugins: [react(), dts({ rollupTypes: true })], + css: { + postcss: { + plugins: [tailwindcss], }, - }; -} - -export default defineConfig(({ isSsrBuild, isPreview }) => { - const isLadle = isSsrBuild === undefined && isPreview === undefined; - - return { - server: { open: false }, - plugins: isLadle - ? [inlineSvg('src/assets/icons.svg', '.ladle/assets/stories-icons.svg')] - : [react(), dts({ rollupTypes: true })], - css: { - postcss: { - plugins: [tailwindcss], - }, + }, + build: { + lib: { + entry: resolve(__dirname, 'src/index.ts'), + name: '@e-krebs/react-library', + fileName: 'index', }, - build: { - lib: { - entry: resolve(__dirname, 'src/index.ts'), - name: '@e-krebs/react-library', - fileName: 'index', - }, - rollupOptions: { - external: ['react', 'react-dom', 'tailwindcss'], - output: { globals: { react: 'React', 'react-dom': 'ReactDOM', tailwindcss: 'tailwindcss' } }, - }, - sourcemap: true, - emptyOutDir: true, + rollupOptions: { + external: ['react', 'react-dom', 'tailwindcss'], + output: { globals: { react: 'React', 'react-dom': 'ReactDOM', tailwindcss: 'tailwindcss' } }, }, - }; + sourcemap: true, + emptyOutDir: true, + }, }); diff --git a/pocstcss.config.js b/pocstcss.config.js new file mode 100644 index 0000000..f1c8dac --- /dev/null +++ b/pocstcss.config.js @@ -0,0 +1,6 @@ +module.exports = { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + } +}