mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 04:16:17 +01:00 
			
		
		
		
	refactor(server): solve some build type errors
This commit is contained in:
		@@ -5,6 +5,7 @@
 | 
				
			|||||||
    "moduleResolution": "bundler",
 | 
					    "moduleResolution": "bundler",
 | 
				
			||||||
    "target": "ES2020",
 | 
					    "target": "ES2020",
 | 
				
			||||||
    "outDir": "dist",
 | 
					    "outDir": "dist",
 | 
				
			||||||
 | 
					    "strict": false,
 | 
				
			||||||
    "types": [
 | 
					    "types": [
 | 
				
			||||||
      "node",
 | 
					      "node",
 | 
				
			||||||
      "express"
 | 
					      "express"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,69 +0,0 @@
 | 
				
			|||||||
const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin');
 | 
					 | 
				
			||||||
const CopyPlugin = require('copy-webpack-plugin');
 | 
					 | 
				
			||||||
const { join } = require('path');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const outputDir = join(__dirname, 'dist');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function buildFilesToCopy() {
 | 
					 | 
				
			||||||
  const files = [];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  files.push({
 | 
					 | 
				
			||||||
    from: "../client/dist",
 | 
					 | 
				
			||||||
    to: join(outputDir, "public")
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  const nodePaths = [
 | 
					 | 
				
			||||||
    // Required as they are native dependencies and cannot be well bundled.
 | 
					 | 
				
			||||||
    "better-sqlite3",
 | 
					 | 
				
			||||||
    "bindings",
 | 
					 | 
				
			||||||
    "file-uri-to-path"
 | 
					 | 
				
			||||||
  ];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  for (const nodePath of nodePaths) {
 | 
					 | 
				
			||||||
    files.push({
 | 
					 | 
				
			||||||
      from: join("node_modules", nodePath),
 | 
					 | 
				
			||||||
      to: join(outputDir, "node_modules", nodePath)
 | 
					 | 
				
			||||||
    })
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return files;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
module.exports = {
 | 
					 | 
				
			||||||
  output: {
 | 
					 | 
				
			||||||
    path: outputDir
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  module: {
 | 
					 | 
				
			||||||
    rules: [
 | 
					 | 
				
			||||||
      {
 | 
					 | 
				
			||||||
        test: /\.css$/i,
 | 
					 | 
				
			||||||
        type: "asset/source"
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    ]
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  plugins: [
 | 
					 | 
				
			||||||
    new NxAppWebpackPlugin({
 | 
					 | 
				
			||||||
      target: 'node',
 | 
					 | 
				
			||||||
      compiler: 'tsc',
 | 
					 | 
				
			||||||
      main: './src/main.ts',
 | 
					 | 
				
			||||||
      tsConfig: './tsconfig.app.json',
 | 
					 | 
				
			||||||
      assets: ["./src/assets"],
 | 
					 | 
				
			||||||
      optimization: false,
 | 
					 | 
				
			||||||
      outputHashing: 'none',
 | 
					 | 
				
			||||||
      generatePackageJson: true,
 | 
					 | 
				
			||||||
      additionalEntryPoints: [
 | 
					 | 
				
			||||||
        "./src/docker_healthcheck.ts"
 | 
					 | 
				
			||||||
      ],
 | 
					 | 
				
			||||||
      externalDependencies: [
 | 
					 | 
				
			||||||
        "electron/main",
 | 
					 | 
				
			||||||
        "@electron/remote/main",
 | 
					 | 
				
			||||||
        "electron",
 | 
					 | 
				
			||||||
        "@electron/remote",        
 | 
					 | 
				
			||||||
        "better-sqlite3"
 | 
					 | 
				
			||||||
      ]
 | 
					 | 
				
			||||||
    }),
 | 
					 | 
				
			||||||
    new CopyPlugin({
 | 
					 | 
				
			||||||
      patterns: buildFilesToCopy()
 | 
					 | 
				
			||||||
    })
 | 
					 | 
				
			||||||
  ]
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
@@ -10,7 +10,7 @@
 | 
				
			|||||||
    "moduleResolution": "nodenext",
 | 
					    "moduleResolution": "nodenext",
 | 
				
			||||||
    "noEmitOnError": true,
 | 
					    "noEmitOnError": true,
 | 
				
			||||||
    "noFallthroughCasesInSwitch": true,
 | 
					    "noFallthroughCasesInSwitch": true,
 | 
				
			||||||
    "noImplicitAny": true,
 | 
					    "noImplicitAny": false,       // TODO: Re-enable it at some point.
 | 
				
			||||||
    "noImplicitOverride": false,  // TODO: Re-enable it at some point.
 | 
					    "noImplicitOverride": false,  // TODO: Re-enable it at some point.
 | 
				
			||||||
    "noImplicitReturns": false,   // TODO: Re-enable it at some point.
 | 
					    "noImplicitReturns": false,   // TODO: Re-enable it at some point.
 | 
				
			||||||
    "noUnusedLocals": false,      // TODO: Re-enable it at some point.
 | 
					    "noUnusedLocals": false,      // TODO: Re-enable it at some point.
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user