const glob = require("glob"); const path = require("node:path"); const { fileURLToPath } = require("node:url"); const nodeResolve = require("@rollup/plugin-node-resolve"); const babel = require("@rollup/plugin-babel"); const common = require("@rollup/plugin-commonjs"); const copy = require("rollup-plugin-copy"); module.exports = { input: Object.fromEntries(glob.sync("dist/**/*.jsx").map((file) => [ // This remove `src/` as well as the file extension from each // file, so e.g. src/nested/foo.js becomes nested/foo path.relative( "dist", file.slice(0, file.length - path.extname(file).length) ), // This expands the relative paths to absolute paths, so e.g. // src/nested/foo becomes /project/src/nested/foo.js file, ])), output: { format: "es", dir: "dist", }, preserveEntrySignatures: false, plugins: [ nodeResolve({ exportConditions: ["solid"] }), babel({ babelHelpers: "bundled", presets: [["solid", { generate: "ssr", hydratable: true }]], }), common(), copy({ targets: [ { src: ["shared/static/*"], dest: "ssr/public", }, ], }), ], };