added solid.js as front end
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
const esbuild = require("esbuild");
|
||||
const { solidPlugin } = require("esbuild-plugin-solid");
|
||||
const path = require("path");
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
const watch = args.includes("--watch");
|
||||
const deploy = args.includes("--deploy");
|
||||
|
||||
const plugins = [
|
||||
solidPlugin(),
|
||||
];
|
||||
|
||||
const nodePaths = [
|
||||
path.resolve(__dirname, "../deps"),
|
||||
path.resolve(__dirname, "../_build/dev/lib")
|
||||
];
|
||||
|
||||
let opts = {
|
||||
entryPoints: ["js/app.js"],
|
||||
bundle: true,
|
||||
logLevel: "info",
|
||||
target: "es2022",
|
||||
outdir: "../priv/static/assets/js",
|
||||
external: ["/fonts/*", "/images/*"],
|
||||
alias: {
|
||||
"phoenix-colocated/river_connect": path.resolve(__dirname, "js/phoenix-colocated-shim.js")
|
||||
},
|
||||
loader: {
|
||||
".js": "jsx",
|
||||
},
|
||||
plugins: plugins,
|
||||
};
|
||||
|
||||
process.env.NODE_PATH = nodePaths.join(path.delimiter);
|
||||
|
||||
if (deploy) {
|
||||
opts = {
|
||||
...opts,
|
||||
minify: true,
|
||||
};
|
||||
}
|
||||
|
||||
if (watch) {
|
||||
opts = {
|
||||
...opts,
|
||||
sourcemap: "inline",
|
||||
};
|
||||
esbuild.context(opts).then(ctx => {
|
||||
ctx.watch();
|
||||
});
|
||||
} else {
|
||||
esbuild.build(opts).catch(() => process.exit(1));
|
||||
}
|
||||
Reference in New Issue
Block a user