Skip to content

Commit

Permalink
fix: umd build so it can be used in browser (excalidraw#7349)
Browse files Browse the repository at this point in the history
* fix: umd build so it can be used in browser

* fix lint

* increase size limit

* update changelog

* use json.stringify for env preact variable so its accessible as string

* update changelog
  • Loading branch information
ad1992 committed Nov 28, 2023
1 parent dd220bc commit f299514
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dev-docs/docs/@excalidraw/excalidraw/faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
},
```

Expand Down
2 changes: 1 addition & 1 deletion dev-docs/docs/@excalidraw/excalidraw/integration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
},
```
:::
Expand Down
2 changes: 1 addition & 1 deletion src/packages/excalidraw/.size-limit.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{
"path": "dist/excalidraw.production.min.js",
"limit": "325 kB"
"limit": "335 kB"
},
{
"path": "dist/excalidraw-assets/locales",
Expand Down
10 changes: 10 additions & 0 deletions src/packages/excalidraw/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions src/packages/excalidraw/webpack.preact.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const { merge } = require("webpack-merge");

const prodConfig = require("./webpack.prod.config");
const devConfig = require("./webpack.dev.config");

Expand All @@ -11,6 +9,7 @@ const outputFile = isProd
: "excalidraw-with-preact.development";

const preactWebpackConfig = {
...config,
entry: {
[outputFile]: "./entry.js",
},
Expand All @@ -30,4 +29,4 @@ const preactWebpackConfig = {
},
},
};
module.exports = merge(config, preactWebpackConfig);
module.exports = preactWebpackConfig;

0 comments on commit f299514

Please sign in to comment.