Skip to content

Commit

Permalink
fix icon in demo. Fix config to build example
Browse files Browse the repository at this point in the history
  • Loading branch information
rommguy committed Mar 2, 2024
1 parent e967e5d commit 7c8159c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 47 deletions.
3 changes: 2 additions & 1 deletion src/example/demoComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { demoText } from "./demoText.ts";
import { times, map } from "lodash/fp";
import "./demoComp.css";
import { CSSProperties, useState } from "react";
import Giraffe from "./giraffe-icon.png";

interface DemoCompProps {
demoType:
Expand Down Expand Up @@ -64,7 +65,7 @@ export const DemoComp = ({ demoType, descriptionSide }: DemoCompProps) => {
style={descriptionStyle}
>
<div className="example-description">
<img src="src/example/giraffe-icon.png" />
<img src={Giraffe} />
There are no limits for your design.
</div>
<div className="panel crazy-scroll">
Expand Down
53 changes: 7 additions & 46 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,22 @@ import dts from "vite-plugin-dts";

export default defineConfig(({ mode }) => {
const isProdBuild = mode !== "example";
const entry = isProdBuild
? path.resolve(__dirname, "index.ts")
: path.resolve(__dirname, "src/main.tsx");

const external = isProdBuild ? ["react", "react-dom"] : [];
const globals = isProdBuild
? { react: "React", "react-dom": "ReactDOM" }
: {};
if (!isProdBuild) {
return { plugins: [react()], build: { outDir: "exampleDist" } };
}

const baseConfig = {
return {
build: {
lib: {
entry,
entry: path.resolve(__dirname, "index.ts"),
name: "react-custom-scroll",
fileName: (format) => `index.${format}.js`,
},
rollupOptions: {
external,
external: ["react", "react-dom"],
output: {
globals,
globals: { react: "React", "react-dom": "ReactDOM" },
},
},
sourcemap: true,
Expand All @@ -35,39 +31,4 @@ export default defineConfig(({ mode }) => {
port: 5174,
},
};

if (isProdBuild) {
return baseConfig;
}

return {
...baseConfig,
build: { ...baseConfig.build, outDir: "exampleDist" },
};
});

// https://vitejs.dev/config/
// export default defineConfig({
// build: {
// lib: {
// entry: path.resolve(__dirname, "index.ts"),
// name: "react-custom-scroll",
// fileName: (format) => `index.${format}.js`,
// },
// rollupOptions: {
// external: ["react", "react-dom"],
// output: {
// globals: {
// react: "React",
// "react-dom": "ReactDOM",
// },
// },
// },
// sourcemap: true,
// emptyOutDir: true,
// },
// plugins: [react(), dts()],
// server: {
// port: 5174,
// },
// });

0 comments on commit 7c8159c

Please sign in to comment.