diff --git a/.gitignore b/.gitignore index 331987095..1d9fa6027 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ *.jar *.syso .DS_Store +.eslintcache app/node_modules app/stage/build app/build diff --git a/app/.eslintignore b/app/.eslintignore index 32cf11dc2..bcb46bd82 100644 --- a/app/.eslintignore +++ b/app/.eslintignore @@ -3,4 +3,6 @@ dist electron node_modules public -*.js +src/asset/pdf +stage +appearance diff --git a/app/.eslintrc.js b/app/.eslintrc.js index 5540969ad..cc798ff9f 100644 --- a/app/.eslintrc.js +++ b/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", }, -} +}; diff --git a/app/package.json b/app/package.json index ea5a80bef..4fb64c799 100644 --- a/app/package.json +++ b/app/package.json @@ -6,7 +6,7 @@ "main": "./electron/main.js", "packageManager": "pnpm@7.26.1", "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", diff --git a/app/src/emoji/index.ts b/app/src/emoji/index.ts index 33f023fba..29a36c7e9 100644 --- a/app/src/emoji/index.ts +++ b/app/src/emoji/index.ts @@ -410,7 +410,7 @@ export const updateFileTreeEmoji = (unicode: string, id: string, icon = "iconFil /// #if MOBILE emojiElement = document.querySelector(`#sidebar [data-type="sidebar-file"] [data-node-id="${id}"] .b3-list-item__icon`); /// #else - const dockFile = getDockByType("file") + const dockFile = getDockByType("file"); if (dockFile) { const files = dockFile.data.file as Files; if (icon === "iconFile") { diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index 40078f2e8..eb2735477 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -1478,7 +1478,7 @@ export class WYSIWYG { let shiftStartElement: HTMLElement; this.element.addEventListener("click", (event: MouseEvent & { target: HTMLElement }) => { hideElements(["hint", "util"], protyle); - const ctrlIsPressed = event.metaKey || event.ctrlKey + const ctrlIsPressed = event.metaKey || event.ctrlKey; /// #if !MOBILE const backlinkBreadcrumbItemElement = hasClosestByClassName(event.target, "protyle-breadcrumb__item"); if (backlinkBreadcrumbItemElement) { diff --git a/app/src/search/util.ts b/app/src/search/util.ts index 5aa7ee407..1634047ec 100644 --- a/app/src/search/util.ts +++ b/app/src/search/util.ts @@ -903,19 +903,19 @@ const updateConfig = (element: Element, item: ISearchOption, config: ISearchOpti } (element.querySelector("#searchInput") as HTMLInputElement).value = item.k; (element.querySelector("#replaceInput") as HTMLInputElement).value = item.r; - let methodTip = window.siyuan.languages.searchMethod + " " + let methodTip = window.siyuan.languages.searchMethod + " "; switch (item.method) { case 0: methodTip += window.siyuan.languages.keyword; break; case 1: - methodTip += window.siyuan.languages.querySyntax + methodTip += window.siyuan.languages.querySyntax; break; case 2: - methodTip += "SQL" + methodTip += "SQL"; break; case 3: - methodTip += window.siyuan.languages.regex + methodTip += window.siyuan.languages.regex; break; } element.querySelector("#searchSyntaxCheck").setAttribute("aria-label", methodTip); diff --git a/app/webpack.api.js b/app/webpack.api.js index 1dd33f01c..3233b944a 100644 --- a/app/webpack.api.js +++ b/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), }), ], - } -} + }; +}; diff --git a/app/webpack.config.js b/app/webpack.config.js index 876005720..40e843418 100644 --- a/app/webpack.config.js +++ b/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", }), ], - } -} + }; +}; diff --git a/app/webpack.desktop.js b/app/webpack.desktop.js index 7ca2601ea..aa67163a8 100644 --- a/app/webpack.desktop.js +++ b/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", }), ], - } -} + }; +}; diff --git a/app/webpack.export.js b/app/webpack.export.js index 00713faae..d80faca01 100644 --- a/app/webpack.export.js +++ b/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", }), ], - } -} + }; +}; diff --git a/app/webpack.mobile.js b/app/webpack.mobile.js index 211383121..193aeae17 100644 --- a/app/webpack.mobile.js +++ b/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", }), ], - } -} + }; +};