From 6cd9195cf3fb1c48d40b8542146dfc09931359af Mon Sep 17 00:00:00 2001 From: FinnIckler Date: Mon, 5 Jun 2023 20:39:13 +0200 Subject: [PATCH] added svg file loader --- build.js | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/build.js b/build.js index d928805..c9432a7 100644 --- a/build.js +++ b/build.js @@ -1,27 +1,30 @@ -const { build } = require("esbuild"); +const { build } = require('esbuild') const { sassPlugin } = require('esbuild-sass-plugin') -const { nodeExternalsPlugin } = require('esbuild-node-externals'); +const { nodeExternalsPlugin } = require('esbuild-node-externals') -const entryFile = "src/index.ts"; +const entryFile = 'src/index.ts' const shared = { - bundle: true, - entryPoints: [entryFile], - logLevel: "info", - minify: true, - sourcemap: true, - plugins: [sassPlugin(), nodeExternalsPlugin()] -}; + bundle: true, + entryPoints: [entryFile], + logLevel: 'info', + minify: true, + sourcemap: true, + plugins: [sassPlugin(), nodeExternalsPlugin()], + loader: { + '.svg': 'file', + }, +} build({ - ...shared, - format: "esm", - outfile: "./dist/index.esm.js", - target: ["esnext", "node12.22.0"], -}); + ...shared, + format: 'esm', + outfile: './dist/index.esm.js', + target: ['esnext', 'node12.22.0'], +}) build({ - ...shared, - format: "cjs", - outfile: "./dist/index.cjs.js", - target: ["esnext", "node12.22.0"], -}); \ No newline at end of file + ...shared, + format: 'cjs', + outfile: './dist/index.cjs.js', + target: ['esnext', 'node12.22.0'], +})