Skip to content

Commit

Permalink
fix dayjs is not excluded in dist (#6767)
Browse files Browse the repository at this point in the history
  • Loading branch information
shifeng1993 authored Jul 29, 2023
1 parent 4fe57fa commit 37059c3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions webpack.build.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ function addLocales(webpackConfig) {
}

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

0 comments on commit 37059c3

Please sign in to comment.