fix dayjs is not excluded in dist (#6767)

pull/6799/head
果冻橙 2023-07-29 12:16:17 +08:00 committed by GitHub
parent 4fe57fa322
commit 37059c38fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -14,14 +14,15 @@ function addLocales(webpackConfig) {
} }
function externalDayjs(config) { function externalDayjs(config) {
config.externals.dayjs = { config.externals.push({
dayjs: { dayjs: {
root: 'dayjs', root: 'dayjs',
commonjs2: 'dayjs', commonjs2: 'dayjs',
commonjs: 'dayjs', commonjs: 'dayjs',
amd: 'dayjs', amd: 'dayjs',
module: 'dayjs',
}, },
}; });
config.externals.push(function ({ _context, request }, callback) { config.externals.push(function ({ _context, request }, callback) {
if (/^dayjs\/plugin\//.test(request)) { if (/^dayjs\/plugin\//.test(request)) {
const name = request.replace(/\//g, '_'); const name = request.replace(/\//g, '_');
@ -30,6 +31,7 @@ function externalDayjs(config) {
commonjs2: name, commonjs2: name,
commonjs: name, commonjs: name,
amd: name, amd: name,
module: name,
}); });
} }
callback(); callback();