setup rspack

Co-authored-by: Percs <Percslol@users.noreply.github.com>
This commit is contained in:
Avad3 2024-07-14 05:38:56 -04:00
parent b448c5505b
commit 146c202ae2
5 changed files with 2847 additions and 144 deletions

49
rspack.config.js Normal file
View file

@ -0,0 +1,49 @@
import { defineConfig } from "@rspack/cli";
// import { RsdoctorRspackPlugin } from "@rsdoctor/rspack-plugin";
import { join } from "path";
import { fileURLToPath } from "url";
const __dirname = fileURLToPath(new URL(".", import.meta.url));
export default defineConfig({
entry: {
shared: join(__dirname, "src/shared/index.ts"),
worker: join(__dirname, "src/worker/index.ts"),
client: join(__dirname, "src/client/index.ts"),
config: join(__dirname, "src/scramjet.config.ts"),
codecs: join(__dirname, "src/codecs/index.ts"),
},
resolve: {
extensions: [".ts", ".js"],
},
module: {
rules: [
{
test: /\.ts$/,
use: "builtin:swc-loader",
exclude: ["/node_modules/"],
options: {
jsc: {
parser: {
syntax: "typescript"
}
}
},
type: "javascript/auto"
}
]
},
output: {
filename: "scramjet.[name].js",
path: join(__dirname, "dist")
},
plugins: [
// new RsdoctorRspackPlugin({
// supports: {
// parseBundle: true,
// banner: true
// }
// })
],
watch: true
});