From 4e0bed01e5aef5faeea4cf7734487767d6adcf36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sea=20/=20=E7=A5=9E=E7=A7=98=E6=B5=B7?= <45450994+warmthsea@users.noreply.github.com> Date: Wed, 15 May 2024 19:01:34 +0800 Subject: [PATCH] chore(build): fix cdn process error (#16870) * chore: fix cdn process error * chore: add deps @rollup/plugin-replace --- internal/build/package.json | 1 + internal/build/src/tasks/full-bundle.ts | 4 ++++ pnpm-lock.yaml | 30 +++++++++++++++++++------ 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/internal/build/package.json b/internal/build/package.json index d8357b811cfd2..873c3f6067416 100644 --- a/internal/build/package.json +++ b/internal/build/package.json @@ -20,6 +20,7 @@ "@pnpm/logger": "^4.0.0", "@rollup/plugin-commonjs": "^22.0.1", "@rollup/plugin-node-resolve": "^13.3.0", + "@rollup/plugin-replace": "^5.0.5", "@vitejs/plugin-vue": "^2.3.3", "@vitejs/plugin-vue-jsx": "^1.3.10", "chalk": "^5.0.1", diff --git a/internal/build/src/tasks/full-bundle.ts b/internal/build/src/tasks/full-bundle.ts index a14c2d1e695a7..ed5c420cd0128 100644 --- a/internal/build/src/tasks/full-bundle.ts +++ b/internal/build/src/tasks/full-bundle.ts @@ -1,6 +1,7 @@ import path from 'path' import { nodeResolve } from '@rollup/plugin-node-resolve' import { rollup } from 'rollup' +import replace from '@rollup/plugin-replace' import commonjs from '@rollup/plugin-commonjs' import vue from '@vitejs/plugin-vue' import VueMacros from 'unplugin-vue-macros/rollup' @@ -59,6 +60,9 @@ async function buildFullEntry(minify: boolean) { treeShaking: true, legalComments: 'eof', }), + replace({ + 'process.env.NODE_ENV': JSON.stringify('production'), + }), ] if (minify) { plugins.push( diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2ac45228e3aeb..cf13ec0e93971 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -361,6 +361,9 @@ importers: '@rollup/plugin-node-resolve': specifier: ^13.3.0 version: 13.3.0(rollup@2.75.7) + '@rollup/plugin-replace': + specifier: ^5.0.5 + version: 5.0.5(rollup@2.75.7) '@vitejs/plugin-vue': specifier: ^2.3.3 version: 2.3.3(vite@2.9.15)(vue@3.2.37) @@ -3746,6 +3749,20 @@ packages: rollup: 2.75.6 dev: true + /@rollup/plugin-replace@5.0.5(rollup@2.75.7): + resolution: {integrity: sha512-rYO4fOi8lMaTg/z5Jb+hKnrHHVn8j2lwkqwyS4kTRhKyWOLf2wST2sWXr4WzWiTcoHTp2sTjqUbqIj2E39slKQ==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + dependencies: + '@rollup/pluginutils': 5.1.0(rollup@2.75.7) + magic-string: 0.30.8 + rollup: 2.75.7 + dev: false + /@rollup/pluginutils@3.1.0(rollup@2.75.6): resolution: {integrity: sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==} engines: {node: '>= 8.0.0'} @@ -3789,7 +3806,7 @@ packages: estree-walker: 2.0.2 picomatch: 2.3.1 - /@rollup/pluginutils@5.1.0: + /@rollup/pluginutils@5.1.0(rollup@2.75.7): resolution: {integrity: sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==} engines: {node: '>=14.0.0'} peerDependencies: @@ -3801,7 +3818,7 @@ packages: '@types/estree': 1.0.5 estree-walker: 2.0.2 picomatch: 2.3.1 - dev: true + rollup: 2.75.7 /@rollup/rollup-android-arm-eabi@4.13.0: resolution: {integrity: sha512-5ZYPOuaAqEH/W3gYsRkxQATBW3Ii1MfaT4EQstTnLKViLi2gLSQmlmtTpGucNP3sXEpOiI5tdGhjdE111ekyEg==} @@ -3969,7 +3986,6 @@ packages: /@types/estree@1.0.5: resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} - dev: true /@types/expect@1.20.4: resolution: {integrity: sha512-Q5Vn3yjTDyCMV50TB6VRIbQNxSE4OmZR86VSbGaNpfUolm0iePBB4KdEEHmxoY5sT2+2DIvXW0rvMDP2nHZ4Mg==} @@ -4654,7 +4670,7 @@ packages: optional: true dependencies: '@babel/types': 7.24.0 - '@rollup/pluginutils': 5.1.0 + '@rollup/pluginutils': 5.1.0(rollup@2.75.7) '@vue/compiler-sfc': 3.4.21 ast-kit: 0.11.3 local-pkg: 0.5.0 @@ -5745,7 +5761,7 @@ packages: engines: {node: '>=16.14.0'} dependencies: '@babel/parser': 7.24.1 - '@rollup/pluginutils': 5.1.0 + '@rollup/pluginutils': 5.1.0(rollup@2.75.7) pathe: 1.1.2 transitivePeerDependencies: - rollup @@ -5756,7 +5772,7 @@ packages: engines: {node: '>=16.14.0'} dependencies: '@babel/parser': 7.24.1 - '@rollup/pluginutils': 5.1.0 + '@rollup/pluginutils': 5.1.0(rollup@2.75.7) pathe: 1.1.2 transitivePeerDependencies: - rollup @@ -10541,7 +10557,6 @@ packages: engines: {node: '>=12'} dependencies: '@jridgewell/sourcemap-codec': 1.4.15 - dev: true /magicast@0.3.4: resolution: {integrity: sha512-TyDF/Pn36bBji9rWKHlZe+PZb6Mx5V8IHCSxk7X4aljM4e/vyDvZZYwHewdVaqiA0nb3ghfHU/6AUpDxWoER2Q==} @@ -15060,6 +15075,7 @@ packages: /workbox-google-analytics@6.6.0: resolution: {integrity: sha512-p4DJa6OldXWd6M9zRl0H6vB9lkrmqYFkRQ2xEiNdBFp9U0LhsGO7hsBscVEyH9H2/3eZZt8c97NB2FD9U2NJ+Q==} + deprecated: It is not compatible with newer versions of GA starting with v4, as long as you are using GAv3 it should be ok, but the package is not longer being maintained dependencies: workbox-background-sync: 6.6.0 workbox-core: 6.6.0