Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/pull/7770

Vanessa7a6ea5f22166
diff --git a/app/tsconfig.json b/app/tsconfig.json
index 3add41bd01..05f6b94ca7 100644
--- a/app/tsconfig.json
+++ b/app/tsconfig.json
@@ -3,7 +3,7 @@
"outDir": "./dist/",
"noImplicitAny": true,
"module": "commonjs",
- "target": "es2021",
+ "target": "es6",
"typeRoots": [
"./node_modules/@types"
],
diff --git a/app/webpack.api.js b/app/webpack.api.js
index 3bfc50d456..d7b39366f1 100644
--- a/app/webpack.api.js
+++ b/app/webpack.api.js
@@ -3,67 +3,70 @@ const webpack = require("webpack");
const pkg = require("./package.json");
const {CleanWebpackPlugin} = require("clean-webpack-plugin");
// const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
-const { EsbuildPlugin } = require("esbuild-loader");
+const {EsbuildPlugin} = require("esbuild-loader");
module.exports = (env, argv) => {
- return {
- mode: argv.mode || "development",
- watch: argv.mode !== "production",
- devtool: argv.mode !== "production" ? "eval" : false,
- output: {
- publicPath: "",
- filename: "[name].js",
- path: path.resolve(__dirname, "stage/build/api"),
- libraryTarget: "umd",
- library: "SiYuanAPI",
- libraryExport: "default",
- },
- entry: {
- "api": "./src/api.ts",
- },
- optimization: {
- minimize: true,
- minimizer: [
- new EsbuildPlugin(),
- ],
- },
- resolve: {
- fallback: {
- "path": require.resolve("path-browserify"),
- },
- extensions: [".ts", ".js", ".scss"],
- },
- module: {
- rules: [
- {
- test: /\.ts(x?)$/,
- include: [path.resolve(__dirname, "src")],
- use: [
- {
- loader: "esbuild-loader",
+ return {
+ mode: argv.mode || "development",
+ watch: argv.mode !== "production",
+ devtool: argv.mode !== "production" ? "eval" : false,
+ output: {
+ publicPath: "",
+ filename: "[name].js",
+ path: path.resolve(__dirname, "stage/build/api"),
+ libraryTarget: "umd",
+ library: "SiYuanAPI",
+ libraryExport: "default",
+ },
+ entry: {
+ "api": "./src/api.ts",
+ },
+ optimization: {
+ minimize: true,
+ minimizer: [
+ new EsbuildPlugin({target: "es6"}),
+ ],
+ },
+ resolve: {
+ fallback: {
+ "path": require.resolve("path-browserify"),
},
- {
- loader: "ifdef-loader",
- options: {
- "ifdef-verbose": false,
- BROWSER: true,
- MOBILE: true,
- },
- },
- ],
- }
- ],
- },
- plugins: [
- // new BundleAnalyzerPlugin(),
- new CleanWebpackPlugin({
- cleanOnceBeforeBuildPatterns: [
- path.join(__dirname, "stage/build/api")],
- }),
- new webpack.DefinePlugin({
- NODE_ENV: JSON.stringify(argv.mode),
- SIYUAN_VERSION: JSON.stringify(pkg.version),
- }),
- ],
- };
+ extensions: [".ts", ".js", ".scss"],
+ },
+ module: {
+ rules: [
+ {
+ test: /\.ts(x?)$/,
+ include: [path.resolve(__dirname, "src")],
+ use: [
+ {
+ loader: "esbuild-loader",
+ options: {
+ target: "es6",
+ }
+ },
+ {
+ loader: "ifdef-loader",
+ options: {
+ "ifdef-verbose": false,
+ BROWSER: true,
+ MOBILE: true,
+ },
+ },
+ ],
+ }
+ ],
+ },
+ plugins: [
+ // new BundleAnalyzerPlugin(),
+ new CleanWebpackPlugin({
+ cleanOnceBeforeBuildPatterns: [
+ path.join(__dirname, "stage/build/api")],
+ }),
+ new webpack.DefinePlugin({
+ NODE_ENV: JSON.stringify(argv.mode),
+ SIYUAN_VERSION: JSON.stringify(pkg.version),
+ }),
+ ],
+ };
};
diff --git a/app/webpack.config.js b/app/webpack.config.js
index edb85e9f6a..1a78e14dce 100644
--- a/app/webpack.config.js
+++ b/app/webpack.config.js
@@ -27,7 +27,7 @@ module.exports = (env, argv) => {
optimization: {
minimize: true,
minimizer: [
- new EsbuildPlugin(),
+ new EsbuildPlugin({target: "es2021"}),
],
},
module: {
diff --git a/app/webpack.export.js b/app/webpack.export.js
index 353c3236dc..019e6b743f 100644
--- a/app/webpack.export.js
+++ b/app/webpack.export.js
@@ -25,7 +25,7 @@ module.exports = (env, argv) => {
optimization: {
minimize: true,
minimizer: [
- new EsbuildPlugin(),
+ new EsbuildPlugin({target: "es6"}),
],
},
resolve: {
@@ -42,6 +42,9 @@ module.exports = (env, argv) => {
use: [
{
loader: "esbuild-loader",
+ options: {
+ target: "es6",
+ }
},
{
loader: "ifdef-loader",