2020-11-17 13:08:24 +01:00
|
|
|
import commonjs from "@rollup/plugin-commonjs"
|
|
|
|
import resolve from "@rollup/plugin-node-resolve"
|
2021-09-01 12:41:48 +02:00
|
|
|
import alias from "@rollup/plugin-alias"
|
2020-11-13 16:42:32 +01:00
|
|
|
import svelte from "rollup-plugin-svelte"
|
2021-01-30 01:20:13 +01:00
|
|
|
import { terser } from "rollup-plugin-terser"
|
2021-04-01 14:44:14 +02:00
|
|
|
import postcss from "rollup-plugin-postcss"
|
|
|
|
import svg from "rollup-plugin-svg"
|
2023-01-31 16:54:06 +01:00
|
|
|
import image from "@rollup/plugin-image"
|
2021-04-01 14:44:14 +02:00
|
|
|
import json from "rollup-plugin-json"
|
2022-01-11 15:01:50 +01:00
|
|
|
import nodePolyfills from "rollup-plugin-polyfill-node"
|
2021-09-01 12:41:48 +02:00
|
|
|
import path from "path"
|
2022-01-31 10:32:06 +01:00
|
|
|
import { visualizer } from "rollup-plugin-visualizer"
|
2020-11-13 16:42:32 +01:00
|
|
|
|
|
|
|
const production = !process.env.ROLLUP_WATCH
|
2021-04-01 20:25:56 +02:00
|
|
|
const ignoredWarnings = [
|
|
|
|
"unused-export-let",
|
|
|
|
"css-unused-selector",
|
|
|
|
"module-script-reactive-declaration",
|
|
|
|
"a11y-no-onchange",
|
2023-01-31 20:34:32 +01:00
|
|
|
"a11y-click-events-have-key-events",
|
2021-04-01 20:25:56 +02:00
|
|
|
]
|
2019-09-06 14:04:23 +02:00
|
|
|
|
2023-03-09 09:50:26 +01:00
|
|
|
const devPaths = production
|
|
|
|
? []
|
|
|
|
: [
|
|
|
|
{
|
|
|
|
find: "@budibase/shared-core",
|
|
|
|
replacement: path.resolve("../shared-core/dist/mjs/src/index"),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
find: "@budibase/types",
|
|
|
|
replacement: path.resolve("../types/dist/mjs/index"),
|
|
|
|
},
|
|
|
|
]
|
|
|
|
|
2019-09-06 14:04:23 +02:00
|
|
|
export default {
|
2020-02-03 10:24:25 +01:00
|
|
|
input: "src/index.js",
|
|
|
|
output: [
|
|
|
|
{
|
2021-04-01 14:44:14 +02:00
|
|
|
sourcemap: false,
|
2021-01-07 15:53:18 +01:00
|
|
|
format: "iife",
|
2020-11-25 17:03:52 +01:00
|
|
|
file: `./dist/budibase-client.js`,
|
2020-02-03 10:24:25 +01:00
|
|
|
},
|
|
|
|
],
|
2022-10-06 10:54:43 +02:00
|
|
|
onwarn(warning, warn) {
|
|
|
|
if (
|
|
|
|
warning.code === "THIS_IS_UNDEFINED" ||
|
|
|
|
warning.code === "CIRCULAR_DEPENDENCY"
|
|
|
|
) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
warn(warning)
|
|
|
|
},
|
2020-02-03 10:24:25 +01:00
|
|
|
plugins: [
|
2021-09-01 12:41:48 +02:00
|
|
|
alias({
|
|
|
|
entries: [
|
|
|
|
{
|
|
|
|
find: "manifest.json",
|
|
|
|
replacement: path.resolve("./manifest.json"),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
find: "api",
|
|
|
|
replacement: path.resolve("./src/api"),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
find: "components",
|
|
|
|
replacement: path.resolve("./src/components"),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
find: "stores",
|
|
|
|
replacement: path.resolve("./src/stores"),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
find: "utils",
|
|
|
|
replacement: path.resolve("./src/utils"),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
find: "constants",
|
|
|
|
replacement: path.resolve("./src/constants"),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
find: "sdk",
|
|
|
|
replacement: path.resolve("./src/sdk"),
|
|
|
|
},
|
2023-03-09 09:50:26 +01:00
|
|
|
...devPaths,
|
2021-09-01 12:41:48 +02:00
|
|
|
],
|
|
|
|
}),
|
2020-11-13 16:42:32 +01:00
|
|
|
svelte({
|
2021-04-01 14:44:14 +02:00
|
|
|
emitCss: true,
|
2021-04-01 20:25:56 +02:00
|
|
|
onwarn: (warning, handler) => {
|
|
|
|
// Ignore some warnings
|
|
|
|
if (!ignoredWarnings.includes(warning.code)) {
|
|
|
|
handler(warning)
|
|
|
|
}
|
|
|
|
},
|
2020-11-13 16:42:32 +01:00
|
|
|
}),
|
2021-04-01 14:44:14 +02:00
|
|
|
postcss(),
|
2021-04-01 17:09:16 +02:00
|
|
|
commonjs(),
|
2022-01-11 15:01:50 +01:00
|
|
|
nodePolyfills(),
|
2020-02-03 10:24:25 +01:00
|
|
|
resolve({
|
|
|
|
preferBuiltins: true,
|
|
|
|
browser: true,
|
2021-04-01 20:41:54 +02:00
|
|
|
dedupe: ["svelte", "svelte/internal"],
|
2020-02-03 10:24:25 +01:00
|
|
|
}),
|
2021-04-01 14:44:14 +02:00
|
|
|
svg(),
|
2023-01-31 20:34:32 +01:00
|
|
|
image({
|
|
|
|
exclude: "**/*.svg",
|
|
|
|
}),
|
2021-04-01 14:44:14 +02:00
|
|
|
json(),
|
2021-01-30 01:20:13 +01:00
|
|
|
production && terser(),
|
2022-02-14 19:01:43 +01:00
|
|
|
!production && visualizer(),
|
2020-02-03 10:24:25 +01:00
|
|
|
],
|
|
|
|
watch: {
|
|
|
|
clearScreen: false,
|
|
|
|
},
|
|
|
|
}
|