md/vue.config.js

36 lines
844 B
JavaScript
Raw Permalink Normal View History

const isProd = process.env.NODE_ENV === `production`
const crypto = require(`crypto`)
2023-05-10 17:23:23 +08:00
/**
* 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`)
2023-05-10 17:23:23 +08:00
} catch (e) {
const origCreateHash = crypto.createHash
2023-05-10 17:23:23 +08:00
crypto.createHash = (alg, opts) => {
return origCreateHash(alg === `md4` ? `md5` : alg, opts)
}
2023-05-10 17:23:23 +08:00
}
module.exports = {
lintOnSave: true,
publicPath: process.env.SERVER_ENV === `NETLIFY` ? `/` : `/md/`, // 基本路径, 建议以绝对路径跟随访问目录
configureWebpack: (config) => {
config.module.rules.push({
test: /\.(txt|md)$/i,
use: [
{
loader: `raw-loader`,
},
],
})
},
productionSourceMap: !isProd,
css: {
sourceMap: !isProd,
},
}