mirror of
https://github.com/excalidraw/excalidraw.git
synced 2026-12-05 18:55:28 +03:00
* chore(packages/sloppy): vendor roughjs as @excalidraw/sloppy - port roughjs 4.6.4 with hachure-fill, path-data-parser and points-on-path into packages/sloppy - move points-on-curve and roughjs's Random into @excalidraw/math - output is identical to roughjs 4.6.4 (tests/parity.test.ts) * fix(packages/sloppy): don't change the caller's points in polygon pattern fills The fillers rotate a polygon's points in place and back, which left float drift in an element's points every time a sharp, pattern-filled line's shape was regenerated.
55 lines
1.2 KiB
JavaScript
55 lines
1.2 KiB
JavaScript
const { build } = require("esbuild");
|
|
|
|
// contains all dependencies bundled inside
|
|
const getConfig = (outdir) => ({
|
|
outdir,
|
|
bundle: true,
|
|
format: "esm",
|
|
entryPoints: ["src/index.ts"],
|
|
entryNames: "[name]",
|
|
assetNames: "[dir]/[name]",
|
|
// resolve workspace packages (linked through node_modules) to their
|
|
// sources: see the "excalidraw-source" condition in their `exports`
|
|
conditions: ["excalidraw-source"],
|
|
external: [
|
|
"@excalidraw/common",
|
|
"@excalidraw/element",
|
|
"@excalidraw/history",
|
|
"@excalidraw/math",
|
|
"@excalidraw/sloppy",
|
|
"@excalidraw/fractional-indexing",
|
|
],
|
|
});
|
|
|
|
function buildDev(config) {
|
|
return build({
|
|
...config,
|
|
sourcemap: true,
|
|
define: {
|
|
"import.meta.env": JSON.stringify({ DEV: true }),
|
|
},
|
|
});
|
|
}
|
|
|
|
function buildProd(config) {
|
|
return build({
|
|
...config,
|
|
minify: true,
|
|
define: {
|
|
"import.meta.env": JSON.stringify({ PROD: true }),
|
|
},
|
|
});
|
|
}
|
|
|
|
const createESMRawBuild = async () => {
|
|
// development unminified build with source maps
|
|
await buildDev(getConfig("dist/dev"));
|
|
|
|
// production minified build without sourcemaps
|
|
await buildProd(getConfig("dist/prod"));
|
|
};
|
|
|
|
(async () => {
|
|
await createESMRawBuild();
|
|
})();
|