@akanjs/config 0.0.25 → 0.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,43 +0,0 @@
1
- const { composePlugins, withNx } = require("@nx/webpack");
2
- const webpack = require("webpack");
3
- const path = require("path");
4
- const nodeExternals = require("webpack-node-externals");
5
- const { RunScriptWebpackPlugin } = require("run-script-webpack-plugin");
6
- const appName = process.env.NX_TASK_TARGET_PROJECT ?? "unknown";
7
- const GeneratePackageJsonPlugin = require("generate-package-json-webpack-plugin");
8
-
9
- module.exports = composePlugins(withNx(), (config) => {
10
- const tsloaderRule = config.module.rules.find((rule) => rule.loader?.includes("ts-loader"));
11
- if (tsloaderRule)
12
- tsloaderRule.exclude = [
13
- /\.tsx$/, // Explicitly exclude .tsx files
14
- /\/ui\/.*\.(ts|tsx)$/, // Exclude .ts and .tsx files in any "ui" directory
15
- /\/client\/.*\.(ts|tsx)$/, // Exclude .ts and .tsx files in any "client" directory
16
- /\/next\/.*\.(ts|tsx)$/, // Exclude .ts and .tsx files in any "client" directory
17
- /\.store\.ts$/, // Exclude files ending with .store.ts
18
- ];
19
- const basePackage = {
20
- name: `${appName}/backend`,
21
- version: "1.0.0",
22
- main: "./main.js",
23
- engines: { node: ">= 18" },
24
- };
25
- config.plugins.push(new GeneratePackageJsonPlugin(basePackage));
26
-
27
- if (process.env.NX_TASK_TARGET_TARGET !== "serve-backend") return config;
28
- const cwd = process.cwd();
29
- Object.assign(config, {
30
- entry: [path.join(cwd, "node_modules/webpack/hot/poll?100"), `./main.ts`],
31
- mode: "development",
32
- output: {
33
- path: path.join(cwd, `dist/apps/${appName}/backend`),
34
- filename: "main.js",
35
- },
36
- });
37
- config.plugins.push(
38
- new webpack.HotModuleReplacementPlugin(),
39
- new RunScriptWebpackPlugin({ name: "main.js", autoRestart: true })
40
- );
41
- config.externals.push(nodeExternals({ allowlist: ["webpack/hot/poll?100"] }));
42
- return config;
43
- });