fix: cdn dayjs error, close #5874
parent
e79dd3508c
commit
333c48c6ba
|
@ -216,14 +216,16 @@ All rights reserved.
|
||||||
|
|
||||||
if (process.env.RUN_ENV === 'PRODUCTION') {
|
if (process.env.RUN_ENV === 'PRODUCTION') {
|
||||||
const entry = ['./index'];
|
const entry = ['./index'];
|
||||||
config.externals = {
|
config.externals = [
|
||||||
vue: {
|
{
|
||||||
root: 'Vue',
|
vue: {
|
||||||
commonjs2: 'vue',
|
root: 'Vue',
|
||||||
commonjs: 'vue',
|
commonjs2: 'vue',
|
||||||
amd: 'vue',
|
commonjs: 'vue',
|
||||||
|
amd: 'vue',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
];
|
||||||
config.output.library = distFileBaseName;
|
config.output.library = distFileBaseName;
|
||||||
config.output.libraryTarget = 'umd';
|
config.output.libraryTarget = 'umd';
|
||||||
config.optimization = {
|
config.optimization = {
|
||||||
|
|
|
@ -66,7 +66,19 @@ We provide `antd.js` `antd.css` and `antd.min.js` `antd.min.css` under `ant-desi
|
||||||
|
|
||||||
> **We strongly discourage loading the entire files** this will add bloat to your application and make it more difficult to receive bugfixes and updates. Antd is intended to be used in conjunction with a build tool, such as [webpack](https://webpack.github.io/), which will make it easy to import only the parts of antd that you are using.
|
> **We strongly discourage loading the entire files** this will add bloat to your application and make it more difficult to receive bugfixes and updates. Antd is intended to be used in conjunction with a build tool, such as [webpack](https://webpack.github.io/), which will make it easy to import only the parts of antd that you are using.
|
||||||
|
|
||||||
> Note: you should import [dayjs](https://day.js.org/) before using antd.js.
|
> Note: you should import [dayjs](https://day.js.org/) and dayjs plugins before using antd.js.
|
||||||
|
|
||||||
|
Like:
|
||||||
|
|
||||||
|
```html
|
||||||
|
<script src="https://unpkg.com/dayjs/dayjs.min.js"></script>
|
||||||
|
<script src="https://unpkg.com/dayjs/plugin/customParseFormat.js"></script>
|
||||||
|
<script src="https://unpkg.com/dayjs/plugin/weekday.js"></script>
|
||||||
|
<script src="https://unpkg.com/dayjs/plugin/localeData.js"></script>
|
||||||
|
<script src="https://unpkg.com/dayjs/plugin/weekOfYear.js"></script>
|
||||||
|
<script src="https://unpkg.com/dayjs/plugin/weekYear.js"></script>
|
||||||
|
<script src="https://unpkg.com/dayjs/plugin/advancedFormat.js"></script>
|
||||||
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
@ -128,7 +140,6 @@ import 'ant-design-vue/dist/antd.css'; // or 'ant-design-vue/dist/antd.less'
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Links
|
## Links
|
||||||
|
|
||||||
- [Home Page](https://www.antdv.com/)
|
- [Home Page](https://www.antdv.com/)
|
||||||
|
|
|
@ -66,7 +66,19 @@ $ yarn add ant-design-vue
|
||||||
|
|
||||||
> **强烈不推荐使用已构建文件**,这样无法按需加载,而且难以获得底层依赖模块的 bug 快速修复支持。
|
> **强烈不推荐使用已构建文件**,这样无法按需加载,而且难以获得底层依赖模块的 bug 快速修复支持。
|
||||||
|
|
||||||
> 注意:引入 antd.js 前你需要自行引入 [dayjs](https://day.js.org/)。
|
> 注意:引入 antd.js 前你需要自行引入 [dayjs](https://day.js.org/) 及其相关插件。
|
||||||
|
|
||||||
|
如:
|
||||||
|
|
||||||
|
```html
|
||||||
|
<script src="https://unpkg.com/dayjs/dayjs.min.js"></script>
|
||||||
|
<script src="https://unpkg.com/dayjs/plugin/customParseFormat.js"></script>
|
||||||
|
<script src="https://unpkg.com/dayjs/plugin/weekday.js"></script>
|
||||||
|
<script src="https://unpkg.com/dayjs/plugin/localeData.js"></script>
|
||||||
|
<script src="https://unpkg.com/dayjs/plugin/weekOfYear.js"></script>
|
||||||
|
<script src="https://unpkg.com/dayjs/plugin/weekYear.js"></script>
|
||||||
|
<script src="https://unpkg.com/dayjs/plugin/advancedFormat.js"></script>
|
||||||
|
```
|
||||||
|
|
||||||
## 示例
|
## 示例
|
||||||
|
|
||||||
|
|
|
@ -41,12 +41,26 @@ function addLocales(webpackConfig) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function externalDayjs(config) {
|
function externalDayjs(config) {
|
||||||
config.externals.dayjs = {
|
config.externals.push({
|
||||||
root: 'dayjs',
|
dayjs: {
|
||||||
commonjs2: 'dayjs',
|
root: 'dayjs',
|
||||||
commonjs: 'dayjs',
|
commonjs2: 'dayjs',
|
||||||
amd: 'dayjs',
|
commonjs: 'dayjs',
|
||||||
};
|
amd: 'dayjs',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
config.externals.push(function ({ _context, request }, callback) {
|
||||||
|
if (/^dayjs\/plugin\//.test(request)) {
|
||||||
|
const name = request.replaceAll('/', '_');
|
||||||
|
return callback(null, {
|
||||||
|
root: name,
|
||||||
|
commonjs2: name,
|
||||||
|
commonjs: name,
|
||||||
|
amd: name,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
callback();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function injectWarningCondition(config) {
|
function injectWarningCondition(config) {
|
||||||
|
|
Loading…
Reference in New Issue