diff --git a/build/full-bundle.ts b/build/full-bundle.ts index afaeb22a0d..c7afcbb2c0 100644 --- a/build/full-bundle.ts +++ b/build/full-bundle.ts @@ -6,6 +6,7 @@ import fs from 'fs' import commonjs from '@rollup/plugin-commonjs' import vue from 'rollup-plugin-vue' import esbuild from 'rollup-plugin-esbuild' +import replace from 'rollup-plugin-replace' import genDts from './gen-entry-dts' import RollupResolveEntryPlugin from './rollup.plugin.entry' import { epRoot, buildOutput } from './paths' @@ -26,6 +27,9 @@ import { EP_PREFIX, excludes } from './constants' esbuild({ minify: false, }), + replace({ + 'process.env.NODE_ENV': JSON.stringify('production'), + }), ], external(id) { return /^vue/.test(id) @@ -39,6 +43,9 @@ import { EP_PREFIX, excludes } from './constants' file: path.resolve(buildOutput, 'element-plus/dist/index.js'), exports: 'named', name: 'ElementPlus', + globals: { + vue: 'Vue', + }, } const umdMinified = { diff --git a/package.json b/package.json index 818b27848c..416897ca89 100644 --- a/package.json +++ b/package.json @@ -159,7 +159,8 @@ "lodash": "^4.17.20", "mitt": "^2.1.0", "normalize-wheel": "^1.0.1", - "resize-observer-polyfill": "^1.5.1" + "resize-observer-polyfill": "^1.5.1", + "rollup-plugin-replace": "^2.2.0" }, "files": [ "lib", diff --git a/packages/components/virtual-list/src/components/fixed-size-list.ts b/packages/components/virtual-list/src/components/fixed-size-list.ts index 3633e45456..0c480afe4b 100644 --- a/packages/components/virtual-list/src/components/fixed-size-list.ts +++ b/packages/components/virtual-list/src/components/fixed-size-list.ts @@ -33,7 +33,7 @@ const FixedSizeList = buildList({ scrollOffset, ) => { const size = (isHorizontal(layout) ? width : height) as number - if (process.env.ENV !== 'production' && isString(size)) { + if (process.env.NODE_ENV !== 'production' && isString(size)) { throwError('[ElVirtualList]', ` You should set width/height diff --git a/yarn.lock b/yarn.lock index 066f41cf16..13e4806b97 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9180,7 +9180,7 @@ macos-release@^2.2.0: version "2.4.1" resolved "https://registry.yarnpkg.com/macos-release/-/macos-release-2.4.1.tgz#64033d0ec6a5e6375155a74b1a1eba8e509820ac" -magic-string@^0.25.7: +magic-string@^0.25.2, magic-string@^0.25.7: version "0.25.7" resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.7.tgz#3f497d6fd34c669c6798dcb821f2ef31f5445051" dependencies: @@ -11984,6 +11984,14 @@ rollup-plugin-filesize@^9.1.1: pacote "^11.2.7" terser "^5.6.0" +rollup-plugin-replace@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-replace/-/rollup-plugin-replace-2.2.0.tgz#f41ae5372e11e7a217cde349c8b5d5fd115e70e3" + integrity sha512-/5bxtUPkDHyBJAKketb4NfaeZjL5yLZdeUihSfbF2PQMz+rSTEb8ARKoOl3UBT4m7/X+QOXJo3sLTcq+yMMYTA== + dependencies: + magic-string "^0.25.2" + rollup-pluginutils "^2.6.0" + rollup-plugin-terser@^7.0.2: version "7.0.2" resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz#e8fbba4869981b2dc35ae7e8a502d5c6c04d324d" @@ -12012,7 +12020,7 @@ rollup-plugin-vue@^6.0.0: hash-sum "^2.0.0" rollup-pluginutils "^2.8.2" -rollup-pluginutils@^2.8.2: +rollup-pluginutils@^2.6.0, rollup-pluginutils@^2.8.2: version "2.8.2" resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz#72f2af0748b592364dbd3389e600e5a9444a351e" dependencies: