Skip to content

Commit

Permalink
Fix: bundle errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Akalanka47000 committed Feb 26, 2024
1 parent e3d4754 commit ac01c0b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
Binary file modified bun.lockb
Binary file not shown.
16 changes: 16 additions & 0 deletions esbuild.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
import { execSync } from "child_process";
import { build } from "esbuild";
import { readFile } from "fs/promises";

execSync("rm -rf ./dist && mkdir dist");

const cleaner = {
name: "cleaner",
setup(build) {
build.onLoad({ filter: /store\/index.ts*/ }, async (args) => {
const source = await readFile(args.path, "utf8");
console.log(args.path);
return {
contents: source.replaceAll(`(await import("@dreamworld/addon-redux")).enhancer`, "null"),
loader: "ts"
};
});
}
};

build({
entryPoints: ["./src/index.tsx"],
bundle: true,
Expand All @@ -15,5 +30,6 @@ build({
loader: {
".png": "file"
},
plugins: [cleaner],
external: ["react", "react-dom", "@dreamworld/addon-redux"]
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"scripts": {
"build": "bun run ./esbuild.config.js && bun build:css",
"build:css": "bunx tailwindcss -o ./dist/index.css --minify",
"build:css": "bunx tailwindcss -i src/styles/index.css -o ./dist/index.css --minify",
"bump-version": "bunx --bun automatic-versioning --disable-auto-sync --recursive $(if [ \"$TAG\" != \"latest\" ]; then echo --prerelease; fi) --prerelease-branch=development --prerelease-tag=$TAG --name=@mezh-hq/react-seat-toolkit --ignore-prefixes=ci",
"format": "bunx prettier --write --cache \"**/*.{js,jsx,ts,tsx,md,css,yml}\"",
"lint": "bun run --bun eslint . --ext js,jsx,ts,tsx,mdx --ignore-path .gitignore --fix --cache --report-unused-disable-directives",
Expand Down
3 changes: 2 additions & 1 deletion src/store/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { configureStore } from "@reduxjs/toolkit";
import type { StoreEnhancer } from "redux";
import { default as rootReducer } from "./reducers";

const storybook = process.env.NODE_ENV === "storybook";

let withReduxEnhancer;
let withReduxEnhancer: StoreEnhancer<any>;

if (storybook) {
// @ts-expect-error - This is a dynamic import
Expand Down
1 change: 1 addition & 0 deletions src/styles/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
@layer base {
html,
body,
#root,
#storybook-root {
min-height: 100% !important;
height: 100% !important;
Expand Down

0 comments on commit ac01c0b

Please sign in to comment.