feat: proxy

Allowing to put a proxy field into a package.json for both app and
plugin to use it with a wds build-in proxy
This commit is contained in:
Ivan Shmidt
2020-05-18 17:56:36 +02:00
parent d15789ea4a
commit dd93bc9ced
3 changed files with 15 additions and 1 deletions
+7 -1
View File
@@ -14,13 +14,19 @@
* limitations under the License.
*/
import { serveBundle } from '../../lib/bundler';
import fs from 'fs-extra';
import { Command } from 'commander';
import { serveBundle } from '../../lib/bundler';
import { paths } from '../../lib/paths';
export default async (cmd: Command) => {
const pkgPath = paths.resolveTarget('package.json');
const pkg = await fs.readJson(pkgPath);
const waitForExit = await serveBundle({
entry: 'src/index',
checksEnabled: cmd.check,
proxy: pkg.proxy,
});
await waitForExit();
@@ -14,13 +14,19 @@
* limitations under the License.
*/
import fs from 'fs-extra';
import { serveBundle } from '../../lib/bundler';
import { Command } from 'commander';
import { paths } from '../../lib/paths';
export default async (cmd: Command) => {
const pkgPath = paths.resolveTarget('package.json');
const pkg = await fs.readJson(pkgPath);
const waitForExit = await serveBundle({
entry: 'dev/index',
checksEnabled: cmd.check,
proxy: pkg.proxy,
});
await waitForExit();
+2
View File
@@ -15,6 +15,7 @@
*/
import { BundlingPathsOptions } from './paths';
import { ProxyConfigMap } from 'webpack-dev-server';
export type BundlingOptions = {
checksEnabled: boolean;
@@ -23,6 +24,7 @@ export type BundlingOptions = {
export type ServeOptions = BundlingPathsOptions & {
checksEnabled: boolean;
proxy?: ProxyConfigMap;
};
export type BuildOptions = BundlingPathsOptions & {