浏览代码

Merge branch 'master' into dev

Liang Ding 2 年之前
父节点
当前提交
3e813e71ec
共有 9 个文件被更改,包括 201 次插入201 次删除
  1. 1 0
      .gitignore
  2. 3 1
      app/.eslintignore
  3. 16 15
      app/.eslintrc.js
  4. 1 1
      app/package.json
  5. 24 25
      app/webpack.api.js
  6. 43 43
      app/webpack.config.js
  7. 43 44
      app/webpack.desktop.js
  8. 31 32
      app/webpack.export.js
  9. 39 40
      app/webpack.mobile.js

+ 1 - 0
.gitignore

@@ -7,6 +7,7 @@
 *.jar
 *.syso
 .DS_Store
+.eslintcache
 app/node_modules
 app/stage/build
 app/build

+ 3 - 1
app/.eslintignore

@@ -3,4 +3,6 @@ dist
 electron
 node_modules
 public
-*.js
+src/asset/pdf
+stage
+appearance

+ 16 - 15
app/.eslintrc.js

@@ -1,23 +1,24 @@
 module.exports = {
   root: true,
-  parser: '@typescript-eslint/parser',
+  env: { node: true, browser: true, es6: true },
+  parser: "@typescript-eslint/parser",
   plugins: [
-    '@typescript-eslint',
+    "@typescript-eslint",
   ],
   extends: [
-    'eslint:recommended',
-    'plugin:@typescript-eslint/recommended',
+    "eslint:recommended",
+    "plugin:@typescript-eslint/recommended",
   ],
   rules: {
-    semi: [2, 'always'],
-    quotes: [2, 'double', {'avoidEscape': true}],
-    'no-prototype-builtins': 'off',
-    'no-useless-escape': 'off',
-    'no-irregular-whitespace': 'off',
-    '@typescript-eslint/ban-ts-comment': 'off',
-    '@typescript-eslint/no-var-requires': 'off',
-    '@typescript-eslint/explicit-function-return-type': 'off',
-    '@typescript-eslint/explicit-module-boundary-types': 'off',
-    '@typescript-eslint/no-explicit-any': 'off',
+    semi: [2, "always"],
+    quotes: [2, "double", {"avoidEscape": true}],
+    "no-prototype-builtins": "off",
+    "no-useless-escape": "off",
+    "no-irregular-whitespace": "off",
+    "@typescript-eslint/ban-ts-comment": "off",
+    "@typescript-eslint/no-var-requires": "off",
+    "@typescript-eslint/explicit-function-return-type": "off",
+    "@typescript-eslint/explicit-module-boundary-types": "off",
+    "@typescript-eslint/no-explicit-any": "off",
   },
-}
+};

+ 1 - 1
app/package.json

@@ -6,7 +6,7 @@
   "main": "./electron/main.js",
   "packageManager": "pnpm@7.27.0",
   "scripts": {
-    "lint": "eslint . --fix --ext .ts",
+    "lint": "eslint . --fix --cache",
     "dev": "webpack --mode development",
     "dev:mobile": "webpack --mode development --config webpack.mobile.js",
     "dev:desktop": "webpack --mode development --config webpack.desktop.js",

+ 24 - 25
app/webpack.api.js

@@ -1,26 +1,25 @@
-const path = require('path')
-const webpack = require('webpack')
-const pkg = require('./package.json')
-const {CleanWebpackPlugin} = require('clean-webpack-plugin')
-const BundleAnalyzerPlugin = require(
-  'webpack-bundle-analyzer').BundleAnalyzerPlugin
-const TerserPlugin = require('terser-webpack-plugin')
+const path = require("path");
+const webpack = require("webpack");
+const pkg = require("./package.json");
+const {CleanWebpackPlugin} = require("clean-webpack-plugin");
+// const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
+const TerserPlugin = require("terser-webpack-plugin");
 
 module.exports = (env, argv) => {
   return {
-    mode: argv.mode || 'development',
-    watch: argv.mode !== 'production',
-    devtool: argv.mode !== 'production' ? 'eval' : false,
+    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',
+      filename: "[name].js",
+      path: path.resolve(__dirname, "stage/build/api"),
+      libraryTarget: "umd",
+      library: "SiYuanAPI",
+      libraryExport: "default",
     },
     entry: {
-      'api': './src/api.ts',
+      "api": "./src/api.ts",
     },
     optimization: {
       minimize: true,
@@ -37,23 +36,23 @@ module.exports = (env, argv) => {
     },
     resolve: {
       fallback: {
-        'path': require.resolve('path-browserify'),
+        "path": require.resolve("path-browserify"),
       },
-      extensions: ['.ts', '.js', '.scss'],
+      extensions: [".ts", ".js", ".scss"],
     },
     module: {
       rules: [
         {
           test: /\.ts(x?)$/,
-          include: [path.resolve(__dirname, 'src')],
+          include: [path.resolve(__dirname, "src")],
           use: [
             {
-              loader: 'ts-loader',
+              loader: "ts-loader",
             },
             {
-              loader: 'ifdef-loader',
+              loader: "ifdef-loader",
               options: {
-                'ifdef-verbose': false,
+                "ifdef-verbose": false,
                 BROWSER: true,
                 MOBILE: true,
               },
@@ -66,12 +65,12 @@ module.exports = (env, argv) => {
       // new BundleAnalyzerPlugin(),
       new CleanWebpackPlugin({
         cleanOnceBeforeBuildPatterns: [
-          path.join(__dirname, 'stage/build/api')],
+          path.join(__dirname, "stage/build/api")],
       }),
       new webpack.DefinePlugin({
         NODE_ENV: JSON.stringify(argv.mode),
         SIYUAN_VERSION: JSON.stringify(pkg.version),
       }),
     ],
-  }
-}
+  };
+};

+ 43 - 43
app/webpack.config.js

@@ -1,28 +1,28 @@
-const path = require('path')
-const webpack = require('webpack')
-const pkg = require('./package.json')
-const MiniCssExtractPlugin = require('mini-css-extract-plugin')
-const HtmlWebpackPlugin = require('html-webpack-plugin')
-const {CleanWebpackPlugin} = require('clean-webpack-plugin')
-const TerserPlugin = require('terser-webpack-plugin')
+const path = require("path");
+const webpack = require("webpack");
+const pkg = require("./package.json");
+const MiniCssExtractPlugin = require("mini-css-extract-plugin");
+const HtmlWebpackPlugin = require("html-webpack-plugin");
+const {CleanWebpackPlugin} = require("clean-webpack-plugin");
+const TerserPlugin = require("terser-webpack-plugin");
 
 module.exports = (env, argv) => {
   return {
-    mode: argv.mode || 'development',
-    watch: argv.mode !== 'production',
-    devtool: argv.mode !== 'production' ? 'eval' : false,
-    target: 'electron-renderer',
+    mode: argv.mode || "development",
+    watch: argv.mode !== "production",
+    devtool: argv.mode !== "production" ? "eval" : false,
+    target: "electron-renderer",
     output: {
-      publicPath: '',
-      filename: '[name].[chunkhash].js',
-      path: path.resolve(__dirname, 'stage/build/app'),
+      publicPath: "",
+      filename: "[name].[chunkhash].js",
+      path: path.resolve(__dirname, "stage/build/app"),
     },
     entry: {
-      'main': './src/index.ts',
-      'window': './src/window/index.ts',
+      "main": "./src/index.ts",
+      "window": "./src/window/index.ts",
     },
     resolve: {
-      extensions: ['.ts', '.js', '.tpl', '.scss', '.png', '.svg'],
+      extensions: [".ts", ".js", ".tpl", ".scss", ".png", ".svg"],
     },
     optimization: {
       minimize: true,
@@ -42,22 +42,22 @@ module.exports = (env, argv) => {
         {
           test: /\.tpl/,
           include: [
-            path.resolve(__dirname, 'src/assets/template/app/index.tpl'),
-            path.resolve(__dirname, 'src/assets/template/app/window.tpl')],
-          loader: 'html-loader',
+            path.resolve(__dirname, "src/assets/template/app/index.tpl"),
+            path.resolve(__dirname, "src/assets/template/app/window.tpl")],
+          loader: "html-loader",
           options: {
             sources: false,
           },
         },
         {
           test: /\.ts(x?)$/,
-          include: [path.resolve(__dirname, 'src')],
+          include: [path.resolve(__dirname, "src")],
           use: [
             {
-              loader: 'ts-loader',
+              loader: "ts-loader",
             },
             {
-              loader: 'ifdef-loader', options: {
+              loader: "ifdef-loader", options: {
                 BROWSER: false,
                 MOBILE: false,
               },
@@ -67,33 +67,33 @@ module.exports = (env, argv) => {
         {
           test: /\.scss$/,
           include: [
-            path.resolve(__dirname, 'src/assets/scss'),
+            path.resolve(__dirname, "src/assets/scss"),
           ],
           use: [
             MiniCssExtractPlugin.loader,
             {
-              loader: 'css-loader', // translates CSS into CommonJS
+              loader: "css-loader", // translates CSS into CommonJS
             },
             {
-              loader: 'sass-loader', // compiles Sass to CSS
+              loader: "sass-loader", // compiles Sass to CSS
             },
           ],
         },
         {
           test: /\.woff$/,
-          type: 'asset/resource',
+          type: "asset/resource",
           generator: {
-            filename: '../fonts/JetBrainsMono-Regular.woff',
+            filename: "../fonts/JetBrainsMono-Regular.woff",
           },
         },
         {
           test: /\.(png|svg)$/,
           use: [
             {
-              loader: 'file-loader',
+              loader: "file-loader",
               options: {
-                name: '[name].[ext]',
-                outputPath: '../../',
+                name: "[name].[ext]",
+                outputPath: "../../",
               },
             },
           ],
@@ -104,27 +104,27 @@ module.exports = (env, argv) => {
       new CleanWebpackPlugin({
         cleanStaleWebpackAssets: false,
         cleanOnceBeforeBuildPatterns: [
-          path.join(__dirname, 'stage/build/app')],
+          path.join(__dirname, "stage/build/app")],
       }),
       new webpack.DefinePlugin({
         SIYUAN_VERSION: JSON.stringify(pkg.version),
         NODE_ENV: JSON.stringify(argv.mode),
       }),
       new MiniCssExtractPlugin({
-        filename: 'base.[contenthash].css',
+        filename: "base.[contenthash].css",
       }),
       new HtmlWebpackPlugin({
-        inject: 'head',
-        chunks: ['main'],
-        filename: 'index.html',
-        template: 'src/assets/template/app/index.tpl',
+        inject: "head",
+        chunks: ["main"],
+        filename: "index.html",
+        template: "src/assets/template/app/index.tpl",
       }),
       new HtmlWebpackPlugin({
-        inject: 'head',
-        chunks: ['window'],
-        filename: 'window.html',
-        template: 'src/assets/template/app/window.tpl',
+        inject: "head",
+        chunks: ["window"],
+        filename: "window.html",
+        template: "src/assets/template/app/window.tpl",
       }),
     ],
-  }
-}
+  };
+};

+ 43 - 44
app/webpack.desktop.js

@@ -1,25 +1,24 @@
-const path = require('path')
-const webpack = require('webpack')
-const pkg = require('./package.json')
-const MiniCssExtractPlugin = require('mini-css-extract-plugin')
-const HtmlWebpackPlugin = require('html-webpack-plugin')
-const {CleanWebpackPlugin} = require('clean-webpack-plugin')
-const BundleAnalyzerPlugin = require(
-  'webpack-bundle-analyzer').BundleAnalyzerPlugin
-const TerserPlugin = require('terser-webpack-plugin')
+const path = require("path");
+const webpack = require("webpack");
+const pkg = require("./package.json");
+const MiniCssExtractPlugin = require("mini-css-extract-plugin");
+const HtmlWebpackPlugin = require("html-webpack-plugin");
+const {CleanWebpackPlugin} = require("clean-webpack-plugin");
+// const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
+const TerserPlugin = require("terser-webpack-plugin");
 
 module.exports = (env, argv) => {
   return {
-    mode: argv.mode || 'development',
-    watch: argv.mode !== 'production',
-    devtool: argv.mode !== 'production' ? 'eval' : false,
+    mode: argv.mode || "development",
+    watch: argv.mode !== "production",
+    devtool: argv.mode !== "production" ? "eval" : false,
     output: {
-      publicPath: '',
-      filename: '[name].[chunkhash].js',
-      path: path.resolve(__dirname, 'stage/build/desktop'),
+      publicPath: "",
+      filename: "[name].[chunkhash].js",
+      path: path.resolve(__dirname, "stage/build/desktop"),
     },
     entry: {
-      'main': './src/index.ts',
+      "main": "./src/index.ts",
     },
     optimization: {
       minimize: true,
@@ -36,31 +35,31 @@ module.exports = (env, argv) => {
     },
     resolve: {
       fallback: {
-        'path': require.resolve('path-browserify'),
+        "path": require.resolve("path-browserify"),
       },
-      extensions: ['.ts', '.js', '.tpl', '.scss'],
+      extensions: [".ts", ".js", ".tpl", ".scss"],
     },
     module: {
       rules: [
         {
           test: /\.tpl/,
           include: [
-            path.resolve(__dirname, 'src/assets/template/desktop/index.tpl')],
-          loader: 'html-loader',
+            path.resolve(__dirname, "src/assets/template/desktop/index.tpl")],
+          loader: "html-loader",
           options: {
             sources: false,
           },
         },
         {
           test: /\.js$/,
-          include: [path.resolve(__dirname, 'src/asset/pdf')],
+          include: [path.resolve(__dirname, "src/asset/pdf")],
           use: {
-            loader: 'babel-loader',
+            loader: "babel-loader",
             options: {
-              presets: ['@babel/preset-env'],
+              presets: ["@babel/preset-env"],
               plugins: [
                 [
-                  '@babel/plugin-transform-runtime',
+                  "@babel/plugin-transform-runtime",
                   {
                     helpers: false,
                     regenerator: true,
@@ -72,15 +71,15 @@ module.exports = (env, argv) => {
         },
         {
           test: /\.ts(x?)$/,
-          include: [path.resolve(__dirname, 'src')],
+          include: [path.resolve(__dirname, "src")],
           use: [
             {
-              loader: 'ts-loader',
+              loader: "ts-loader",
             },
             {
-              loader: 'ifdef-loader',
+              loader: "ifdef-loader",
               options: {
-                'ifdef-verbose': false,
+                "ifdef-verbose": false,
                 BROWSER: true,
                 MOBILE: false,
               },
@@ -90,33 +89,33 @@ module.exports = (env, argv) => {
         {
           test: /\.scss$/,
           include: [
-            path.resolve(__dirname, 'src/assets/scss'),
+            path.resolve(__dirname, "src/assets/scss"),
           ],
           use: [
             MiniCssExtractPlugin.loader,
             {
-              loader: 'css-loader', // translates CSS into CommonJS
+              loader: "css-loader", // translates CSS into CommonJS
             },
             {
-              loader: 'sass-loader', // compiles Sass to CSS
+              loader: "sass-loader", // compiles Sass to CSS
             },
           ],
         },
         {
           test: /\.woff$/,
-          type: 'asset/resource',
+          type: "asset/resource",
           generator: {
-            filename: '../fonts/JetBrainsMono-Regular.woff',
+            filename: "../fonts/JetBrainsMono-Regular.woff",
           },
         },
         {
           test: /\.(png|svg)$/,
           use: [
             {
-              loader: 'file-loader',
+              loader: "file-loader",
               options: {
-                name: '[name].[ext]',
-                outputPath: '../../',
+                name: "[name].[ext]",
+                outputPath: "../../",
               },
             },
           ],
@@ -128,21 +127,21 @@ module.exports = (env, argv) => {
       new CleanWebpackPlugin({
         cleanStaleWebpackAssets: false,
         cleanOnceBeforeBuildPatterns: [
-          path.join(__dirname, 'stage/build/desktop')],
+          path.join(__dirname, "stage/build/desktop")],
       }),
       new webpack.DefinePlugin({
         SIYUAN_VERSION: JSON.stringify(pkg.version),
         NODE_ENV: JSON.stringify(argv.mode),
       }),
       new MiniCssExtractPlugin({
-        filename: 'base.[contenthash].css',
+        filename: "base.[contenthash].css",
       }),
       new HtmlWebpackPlugin({
-        inject: 'head',
-        chunks: ['main'],
-        filename: 'index.html',
-        template: 'src/assets/template/desktop/index.tpl',
+        inject: "head",
+        chunks: ["main"],
+        filename: "index.html",
+        template: "src/assets/template/desktop/index.tpl",
       }),
     ],
-  }
-}
+  };
+};

+ 31 - 32
app/webpack.export.js

@@ -1,27 +1,26 @@
-const path = require('path')
-const webpack = require('webpack')
-const pkg = require('./package.json')
-const MiniCssExtractPlugin = require('mini-css-extract-plugin')
-const {CleanWebpackPlugin} = require('clean-webpack-plugin')
-const BundleAnalyzerPlugin = require(
-  'webpack-bundle-analyzer').BundleAnalyzerPlugin
-const TerserPlugin = require('terser-webpack-plugin')
+const path = require("path");
+const webpack = require("webpack");
+const pkg = require("./package.json");
+const MiniCssExtractPlugin = require("mini-css-extract-plugin");
+const {CleanWebpackPlugin} = require("clean-webpack-plugin");
+// const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
+const TerserPlugin = require("terser-webpack-plugin");
 
 module.exports = (env, argv) => {
   return {
-    mode: argv.mode || 'development',
-    watch: argv.mode !== 'production',
-    devtool: argv.mode !== 'production' ? 'eval' : false,
+    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/export'),
-      libraryTarget: 'umd',
-      library: 'Protyle',
-      libraryExport: 'default',
+      filename: "[name].js",
+      path: path.resolve(__dirname, "stage/build/export"),
+      libraryTarget: "umd",
+      library: "Protyle",
+      libraryExport: "default",
     },
     entry: {
-      'protyle-method': './src/protyle/method.ts',
+      "protyle-method": "./src/protyle/method.ts",
     },
     optimization: {
       minimize: true,
@@ -38,23 +37,23 @@ module.exports = (env, argv) => {
     },
     resolve: {
       fallback: {
-        'path': require.resolve('path-browserify'),
+        "path": require.resolve("path-browserify"),
       },
-      extensions: ['.ts', '.js', '.scss'],
+      extensions: [".ts", ".js", ".scss"],
     },
     module: {
       rules: [
         {
           test: /\.ts(x?)$/,
-          include: [path.resolve(__dirname, 'src')],
+          include: [path.resolve(__dirname, "src")],
           use: [
             {
-              loader: 'ts-loader',
+              loader: "ts-loader",
             },
             {
-              loader: 'ifdef-loader',
+              loader: "ifdef-loader",
               options: {
-                'ifdef-verbose': false,
+                "ifdef-verbose": false,
                 BROWSER: true,
                 MOBILE: true,
               },
@@ -64,23 +63,23 @@ module.exports = (env, argv) => {
         {
           test: /\.scss$/,
           include: [
-            path.resolve(__dirname, 'src/assets/scss'),
+            path.resolve(__dirname, "src/assets/scss"),
           ],
           use: [
             MiniCssExtractPlugin.loader,
             {
-              loader: 'css-loader', // translates CSS into CommonJS
+              loader: "css-loader", // translates CSS into CommonJS
             },
             {
-              loader: 'sass-loader', // compiles Sass to CSS
+              loader: "sass-loader", // compiles Sass to CSS
             },
           ],
         },
         {
           test: /\.woff$/,
-          type: 'asset/resource',
+          type: "asset/resource",
           generator: {
-            filename: '../fonts/JetBrainsMono-Regular.woff',
+            filename: "../fonts/JetBrainsMono-Regular.woff",
           },
         },
       ],
@@ -89,15 +88,15 @@ module.exports = (env, argv) => {
       // new BundleAnalyzerPlugin(),
       new CleanWebpackPlugin({
         cleanOnceBeforeBuildPatterns: [
-          path.join(__dirname, 'stage/build/export')],
+          path.join(__dirname, "stage/build/export")],
       }),
       new webpack.DefinePlugin({
         NODE_ENV: JSON.stringify(argv.mode),
         SIYUAN_VERSION: JSON.stringify(pkg.version),
       }),
       new MiniCssExtractPlugin({
-        filename: 'base.css',
+        filename: "base.css",
       }),
     ],
-  }
-}
+  };
+};

+ 39 - 40
app/webpack.mobile.js

@@ -1,25 +1,24 @@
-const path = require('path')
-const webpack = require('webpack')
-const pkg = require('./package.json')
-const MiniCssExtractPlugin = require('mini-css-extract-plugin')
-const HtmlWebpackPlugin = require('html-webpack-plugin')
-const {CleanWebpackPlugin} = require('clean-webpack-plugin')
-const BundleAnalyzerPlugin = require(
-  'webpack-bundle-analyzer').BundleAnalyzerPlugin
-const TerserPlugin = require('terser-webpack-plugin')
+const path = require("path");
+const webpack = require("webpack");
+const pkg = require("./package.json");
+const MiniCssExtractPlugin = require("mini-css-extract-plugin");
+const HtmlWebpackPlugin = require("html-webpack-plugin");
+const {CleanWebpackPlugin} = require("clean-webpack-plugin");
+// const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
+const TerserPlugin = require("terser-webpack-plugin");
 
 module.exports = (env, argv) => {
   return {
-    mode: argv.mode || 'development',
-    watch: argv.mode !== 'production',
-    devtool: argv.mode !== 'production' ? 'eval' : false,
+    mode: argv.mode || "development",
+    watch: argv.mode !== "production",
+    devtool: argv.mode !== "production" ? "eval" : false,
     output: {
-      publicPath: '',
-      filename: '[name].[chunkhash].js',
-      path: path.resolve(__dirname, 'stage/build/mobile'),
+      publicPath: "",
+      filename: "[name].[chunkhash].js",
+      path: path.resolve(__dirname, "stage/build/mobile"),
     },
     entry: {
-      'main': './src/mobile/index.ts',
+      "main": "./src/mobile/index.ts",
     },
     optimization: {
       minimize: true,
@@ -36,32 +35,32 @@ module.exports = (env, argv) => {
     },
     resolve: {
       fallback: {
-        'path': require.resolve('path-browserify'),
+        "path": require.resolve("path-browserify"),
       },
-      extensions: ['.ts', '.js', '.tpl', '.scss'],
+      extensions: [".ts", ".js", ".tpl", ".scss"],
     },
     module: {
       rules: [
         {
           test: /\.tpl/,
           include: [
-            path.resolve(__dirname, 'src/assets/template/mobile/index.tpl')],
-          loader: 'html-loader',
+            path.resolve(__dirname, "src/assets/template/mobile/index.tpl")],
+          loader: "html-loader",
           options: {
             sources: false,
           },
         },
         {
           test: /\.ts(x?)$/,
-          include: [path.resolve(__dirname, 'src')],
+          include: [path.resolve(__dirname, "src")],
           use: [
             {
-              loader: 'ts-loader',
+              loader: "ts-loader",
             },
             {
-              loader: 'ifdef-loader',
+              loader: "ifdef-loader",
               options: {
-                'ifdef-verbose': false,
+                "ifdef-verbose": false,
                 BROWSER: true,
                 MOBILE: true,
               },
@@ -71,33 +70,33 @@ module.exports = (env, argv) => {
         {
           test: /\.scss$/,
           include: [
-            path.resolve(__dirname, 'src/assets/scss'),
+            path.resolve(__dirname, "src/assets/scss"),
           ],
           use: [
             MiniCssExtractPlugin.loader,
             {
-              loader: 'css-loader', // translates CSS into CommonJS
+              loader: "css-loader", // translates CSS into CommonJS
             },
             {
-              loader: 'sass-loader', // compiles Sass to CSS
+              loader: "sass-loader", // compiles Sass to CSS
             },
           ],
         },
         {
           test: /\.woff$/,
-          type: 'asset/resource',
+          type: "asset/resource",
           generator: {
-            filename: '../fonts/JetBrainsMono-Regular.woff',
+            filename: "../fonts/JetBrainsMono-Regular.woff",
           },
         },
         {
           test: /\.(png|svg)$/,
           use: [
             {
-              loader: 'file-loader',
+              loader: "file-loader",
               options: {
-                name: '[name].[ext]',
-                outputPath: '../../',
+                name: "[name].[ext]",
+                outputPath: "../../",
               },
             },
           ],
@@ -109,21 +108,21 @@ module.exports = (env, argv) => {
       new CleanWebpackPlugin({
         cleanStaleWebpackAssets: false,
         cleanOnceBeforeBuildPatterns: [
-          path.join(__dirname, 'stage/build/mobile')],
+          path.join(__dirname, "stage/build/mobile")],
       }),
       new webpack.DefinePlugin({
         SIYUAN_VERSION: JSON.stringify(pkg.version),
         NODE_ENV: JSON.stringify(argv.mode),
       }),
       new MiniCssExtractPlugin({
-        filename: 'base.[contenthash].css',
+        filename: "base.[contenthash].css",
       }),
       new HtmlWebpackPlugin({
-        inject: 'head',
-        chunks: ['main'],
-        filename: 'index.html',
-        template: 'src/assets/template/mobile/index.tpl',
+        inject: "head",
+        chunks: ["main"],
+        filename: "index.html",
+        template: "src/assets/template/mobile/index.tpl",
       }),
     ],
-  }
-}
+  };
+};