diff --git a/packages/fes-build-vite/src/dev.js b/packages/fes-build-vite/src/dev.js index e0a48452..1ac5693b 100644 --- a/packages/fes-build-vite/src/dev.js +++ b/packages/fes-build-vite/src/dev.js @@ -3,18 +3,13 @@ import vue from '@vitejs/plugin-vue'; import vueJsx from '@vitejs/plugin-vue-jsx'; import SFCConfigBlockPlugin from './SFCConfigBlockPlugin'; -const assert = require('assert'); - export default (api) => { const { - env, paths, utils: { chalk }, } = api; const unwatchs = []; - let port; - let hostname; let server; function destroy() { @@ -63,30 +58,6 @@ export default (api) => { }, }); - api.registerMethod({ - name: 'getPort', - fn() { - assert(env === 'development', 'api.getPort() is only valid in development.'); - return port; - }, - }); - - api.registerMethod({ - name: 'getHostname', - fn() { - assert(env === 'development', 'api.getHostname() is only valid in development.'); - return hostname; - }, - }); - - api.registerMethod({ - name: 'getServer', - fn() { - assert(env === 'development', 'api.getServer() is only valid in development.'); - return server; - }, - }); - api.registerMethod({ name: 'restartServer', fn() { diff --git a/packages/fes-build-webpack/src/plugins/commands/dev/index.js b/packages/fes-build-webpack/src/plugins/commands/dev/index.js index 6ee8245d..432ceb6f 100644 --- a/packages/fes-build-webpack/src/plugins/commands/dev/index.js +++ b/packages/fes-build-webpack/src/plugins/commands/dev/index.js @@ -3,11 +3,8 @@ * https://github.com/umijs/umi/blob/master/packages/preset-built-in/src/plugins/commands/dev/dev.ts */ -const assert = require('assert'); - export default (api) => { const { - env, paths, utils: { chalk, portfinder, generateFiles }, } = api; @@ -165,30 +162,6 @@ export default (api) => { }, }); - api.registerMethod({ - name: 'getPort', - fn() { - assert(env === 'development', 'api.getPort() is only valid in development.'); - return port; - }, - }); - - api.registerMethod({ - name: 'getHostname', - fn() { - assert(env === 'development', 'api.getHostname() is only valid in development.'); - return hostname; - }, - }); - - api.registerMethod({ - name: 'getServer', - fn() { - assert(env === 'development', 'api.getServer() is only valid in development.'); - return server; - }, - }); - api.registerMethod({ name: 'restartServer', fn() {