Skip to content

Virtual whiteboard for sketching hand-drawn like diagrams

fix: umd build so it can be used in browser (#7349)

Aakansha Doshif299514e445b
diff --git a/dev-docs/docs/@excalidraw/excalidraw/faq.mdx b/dev-docs/docs/@excalidraw/excalidraw/faq.mdx
index 5c66a603f8..e9c6a81d1b 100644
--- a/dev-docs/docs/@excalidraw/excalidraw/faq.mdx
+++ b/dev-docs/docs/@excalidraw/excalidraw/faq.mdx
@@ -39,7 +39,7 @@ Since Vite removes env variables by default, you can update the vite config to e
```
define: {
- "process.env.IS_PREACT": process.env.IS_PREACT,
+ "process.env.IS_PREACT": JSON.stringify("true"),
},
```
diff --git a/dev-docs/docs/@excalidraw/excalidraw/integration.mdx b/dev-docs/docs/@excalidraw/excalidraw/integration.mdx
index aa8e002c57..9fc221bd98 100644
--- a/dev-docs/docs/@excalidraw/excalidraw/integration.mdx
+++ b/dev-docs/docs/@excalidraw/excalidraw/integration.mdx
@@ -93,7 +93,7 @@ Since Vite removes env variables by default, you can update the vite config to e
```
define: {
- "process.env.IS_PREACT": process.env.IS_PREACT,
+ "process.env.IS_PREACT": JSON.stringify("true"),
},
```
:::
diff --git a/src/packages/excalidraw/.size-limit.json b/src/packages/excalidraw/.size-limit.json
index 290de2687c..47562968a5 100644
--- a/src/packages/excalidraw/.size-limit.json
+++ b/src/packages/excalidraw/.size-limit.json
@@ -1,7 +1,7 @@
[
{
"path": "dist/excalidraw.production.min.js",
- "limit": "325 kB"
+ "limit": "335 kB"
},
{
"path": "dist/excalidraw-assets/locales",
diff --git a/src/packages/excalidraw/CHANGELOG.md b/src/packages/excalidraw/CHANGELOG.md
index 368ff41473..1c23f6f85a 100644
--- a/src/packages/excalidraw/CHANGELOG.md
+++ b/src/packages/excalidraw/CHANGELOG.md
@@ -13,6 +13,16 @@ Please add the latest change on the top under the correct section.
## Unreleased
+### Fixes
+
+- Umd build for browser since it was breaking in v0.17.0 [#7349](https://github.com/excalidraw/excalidraw/pull/7349). Also make sure that when using `Vite`, the `process.env.IS_PREACT` is set as `"true"` (string) and not a boolean.
+
+```
+define: {
+ "process.env.IS_PREACT": JSON.stringify("true"),
+}
+```
+
### Breaking Changes
- `appState.openDialog` type was changed from `null | string` to `null | { name: string }`. [#7336](https://github.com/excalidraw/excalidraw/pull/7336)
diff --git a/src/packages/excalidraw/webpack.preact.config.js b/src/packages/excalidraw/webpack.preact.config.js
index c0516a7683..0ae969aa64 100644
--- a/src/packages/excalidraw/webpack.preact.config.js
+++ b/src/packages/excalidraw/webpack.preact.config.js
@@ -1,5 +1,3 @@
-const { merge } = require("webpack-merge");
-
const prodConfig = require("./webpack.prod.config");
const devConfig = require("./webpack.dev.config");
@@ -11,6 +9,7 @@ const outputFile = isProd
: "excalidraw-with-preact.development";
const preactWebpackConfig = {
+ ...config,
entry: {
[outputFile]: "./entry.js",
},
@@ -30,4 +29,4 @@ const preactWebpackConfig = {
},
},
};
-module.exports = merge(config, preactWebpackConfig);
+module.exports = preactWebpackConfig;