2022-01-27 19:26:42 +08:00
|
|
|
const isProd = process.env.NODE_ENV === `production`
|
|
|
|
|
2023-05-10 17:23:23 +08:00
|
|
|
const crypto = require('crypto');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* md4 algorithm is not available anymore in NodeJS 17+ (because of lib SSL 3).
|
|
|
|
* In that case, silently replace md4 by md5 algorithm.
|
|
|
|
*/
|
|
|
|
try {
|
|
|
|
crypto.createHash('md4');
|
|
|
|
} catch (e) {
|
|
|
|
const origCreateHash = crypto.createHash;
|
|
|
|
crypto.createHash = (alg, opts) => {
|
|
|
|
return origCreateHash(alg === 'md4' ? 'md5' : alg, opts);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-11-23 11:07:28 +08:00
|
|
|
module.exports = {
|
2022-03-22 09:58:22 +08:00
|
|
|
lintOnSave: true,
|
2021-11-23 11:07:28 +08:00
|
|
|
publicPath: process.env.SERVER_ENV === `NETLIFY` ? `/` : `/md/`, // 基本路径, 建议以绝对路径跟随访问目录
|
2021-11-24 13:35:35 +08:00
|
|
|
configureWebpack: (config) => {
|
|
|
|
config.module.rules.push({
|
|
|
|
test: /\.(txt|md)$/i,
|
2022-02-28 19:09:39 +08:00
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: `raw-loader`,
|
|
|
|
},
|
|
|
|
],
|
2021-11-24 13:35:35 +08:00
|
|
|
})
|
|
|
|
},
|
2022-01-27 19:26:42 +08:00
|
|
|
productionSourceMap: !isProd,
|
2021-11-23 11:07:28 +08:00
|
|
|
css: {
|
2022-01-27 19:26:42 +08:00
|
|
|
sourceMap: !isProd,
|
2021-11-23 11:07:28 +08:00
|
|
|
},
|
|
|
|
}
|