Skip to content

Commit 5bdbbea

Browse files
chore: update webpack to version 5.74.0 and adjust moment.js locale handling for compatibility
1 parent 08a7aad commit 5bdbbea

File tree

4 files changed

+84
-6
lines changed

4 files changed

+84
-6
lines changed

.github/workflows/cloudflare.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Build and Deploy to Cloudflare
2+
on:
3+
push:
4+
branches: [ master ]
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
name: Build Application
10+
permissions:
11+
contents: read
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v5
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Setup Node
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: 20
22+
23+
- name: Install dependencies
24+
run: npm install --force
25+
26+
- name: Build application
27+
run: npm run build:preview
28+
29+
- name: Upload build artifacts
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: build-files
33+
path: dist/
34+
retention-days: 1
35+
36+
deploy:
37+
runs-on: ubuntu-latest
38+
name: Deploy to Cloudflare
39+
needs: build
40+
permissions:
41+
contents: read
42+
deployments: write
43+
steps:
44+
- name: Checkout (for config files)
45+
uses: actions/checkout@v5
46+
with:
47+
sparse-checkout: |
48+
wrangler.jsonc
49+
sparse-checkout-cone-mode: false
50+
51+
- name: Download build artifacts
52+
uses: actions/download-artifact@v4
53+
with:
54+
name: build-files
55+
path: dist/
56+
57+
- name: Deploy (Workers + Static Assets)
58+
uses: cloudflare/[email protected]
59+
with:
60+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
61+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
62+
command: deploy --config wrangler.jsonc
63+
gitHubToken: ${{ secrets.GITHUB_TOKEN }}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
"stylelint-order": "^5.0.0",
8080
"vue-svg-icon-loader": "^2.1.1",
8181
"vue-svg-loader": "0.16.0",
82+
"webpack": "^5.74.0",
8283
"webpack-theme-color-replacer": "^1.3.26"
8384
},
8485
"config": {

vue.config.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,8 @@ const vueConfig = {
4343
configureWebpack: {
4444
// webpack plugins
4545
plugins: [
46-
// Ignore all locale files of moment.js
47-
new webpack.IgnorePlugin({
48-
contextRegExp: /^\.\/locale$/,
49-
resourceRegExp: /moment$/
50-
}),
46+
// Ignore all locale files of moment.js - disabled for webpack 5 compatibility
47+
// new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
5148
new webpack.DefinePlugin({
5249
APP_VERSION: `"${packageJson.version}"`,
5350
GIT_HASH: JSON.stringify(getGitHash()),
@@ -61,6 +58,9 @@ const vueConfig = {
6158

6259
chainWebpack: config => {
6360
config.resolve.alias.set('@$', resolve('src'))
61+
62+
// Ignore moment.js locale files to reduce bundle size (webpack 5 compatible)
63+
config.resolve.alias.set('moment/locale', false)
6464

6565
// fixed svg-loader by https://github.com/damianstasik/vue-svg-loader/issues/185#issuecomment-1126721069
6666
const svgRule = config.module.rule('svg')
@@ -123,7 +123,7 @@ const vueConfig = {
123123

124124
devServer: {
125125
// development server port 8000
126-
port: 8000
126+
port: 8000,
127127
// If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
128128
// proxy: {
129129
// '/api': {

wrangler.jsonc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "antdv-vue2-pro-preview",
3+
"compatibility_date": "2025-09-19",
4+
"assets": {
5+
"directory": "./dist",
6+
"not_found_handling": "single-page-application"
7+
},
8+
"routes": [
9+
{
10+
"pattern": "preview.pro.antdv.com/*",
11+
"zone_name": "antdv.com"
12+
}
13+
]
14+
}

0 commit comments

Comments
 (0)