From 5cf6fc78ce5592cd4f28026e0687c9d0d100eba5 Mon Sep 17 00:00:00 2001 From: nisarhassan12 Date: Wed, 3 Jul 2019 11:46:07 +0000 Subject: [PATCH] Configures webpackDevServer to allow hosting with gitpod. --- .gitpod.yml | 3 ++- README.md | 4 ++++ scripts/webpack.config.dev.js | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index 3b462bf..721ade9 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,6 +1,7 @@ tasks: + - command: gp await-port 3000 && gp preview $(gp url 3000)/examples/browser/demo.html - init: npm install command: npm start ports: - port: 3000 - onOpen: open-preview \ No newline at end of file + onOpen: ignore \ No newline at end of file diff --git a/README.md b/README.md index 1dba84d..9bd2a6b 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,10 @@ npm start The development server will be available at http://localhost:3000/examples/browser/demo.html in your favorite browser. It will automatically rebuild `tesseract.dev.js` and `worker.min.js` when you change files in the src folder. +You can also run the development server in Gitpod ( a free online IDE and dev environment for GitHub ) with a single click. + +[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/naptha/tesseract.js/blob/master/examples/browser/demo.html) + ### Building Static Files To build the compiled static files just execute the following: ```shell diff --git a/scripts/webpack.config.dev.js b/scripts/webpack.config.dev.js index 8729674..33215a0 100644 --- a/scripts/webpack.config.dev.js +++ b/scripts/webpack.config.dev.js @@ -20,6 +20,9 @@ const genConfig = ({ }, }), ], + devServer: { + allowedHosts: ['localhost', '.gitpod.io'], + }, }); module.exports = [