mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 15:10:12 +01:00
eslint js 文件并启用缓存 --cache (#7330)
* chore: lint js file and use cache to speed up * chore: autofix and format code
This commit is contained in:
parent
9680294d39
commit
ab15c09e26
12 changed files with 207 additions and 207 deletions
|
|
@ -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),
|
||||
}),
|
||||
],
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue