Skip to content

Commit

Permalink
Fix css styles not updating in react-workshop (#2186)
Browse files Browse the repository at this point in the history
Co-authored-by: Rohan <[email protected]>
  • Loading branch information
r100-stack and r100-stack authored Aug 7, 2024
1 parent 2e5fc69 commit 3c376d5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/itwinui-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"format": "prettier --config .prettierrc **/*.{tsx,ts,js} --ignore-path .gitignore --write",
"lint": "eslint \"**/*.{js,ts,tsx}\" --max-warnings=0",
"lint:fix": "pnpm lint --fix && node ../../scripts/copyrightLinter.js --fix \"*/**/*.{js,ts,tsx}\"",
"dev": "pnpm clean:build && concurrently \"pnpm dev:esm\" \"pnpm dev:cjs\" \"pnpm build:styles --watch\" \"pnpm dev:types\"",
"dev": "pnpm clean:build && concurrently \"pnpm dev:esm\" \"pnpm dev:cjs\" \"pnpm dev:styles\" \"pnpm dev:types\"",
"dev:esm": "swc src -d esm --watch --strip-leading-paths",
"dev:cjs": "swc src -d cjs --watch --strip-leading-paths -C module.type=commonjs",
"dev:types": "concurrently \"tsc -p tsconfig.build.json --outDir esm --watch --preserveWatchOutput\" \"tsc -p tsconfig.build.json --outDir cjs --watch --preserveWatchOutput\"",
Expand Down
12 changes: 9 additions & 3 deletions packages/itwinui-react/src/styles.js/vite.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,18 @@ const outEsmDevDir = path.join(root, 'DEV-esm');
const outCjsDevDir = path.join(root, 'DEV-cjs');

const copyBuildOutput = async () => {
// create cjs/ and esm/ directories if they don't exist
// create cjs/, esm/, DEV-cjs/, and DEV-esm/ directories if they don't exist
if (!fs.existsSync(outEsmDir)) {
await fs.promises.mkdir(outEsmDir);
}
if (!fs.existsSync(outCjsDir)) {
await fs.promises.mkdir(outCjsDir);
}
if (!fs.existsSync(outEsmDir)) {
await fs.promises.mkdir(outEsmDir);
if (!fs.existsSync(outEsmDevDir)) {
await fs.promises.mkdir(outEsmDevDir);
}
if (!fs.existsSync(outCjsDevDir)) {
await fs.promises.mkdir(outCjsDevDir);
}

// copy styles.js from src/styles.js/dist/ into cjs/, esm/, DEV-cjs/, and DEV-esm/
Expand Down

0 comments on commit 3c376d5

Please sign in to comment.