Browse Source

Replace NODE_ENV with TESS_ENV to prevent conflict

develop
Jerome Wu 6 years ago
parent
commit
8a3e0a6e28
  1. 2
      dist/tesseract.min.js
  2. 2
      dist/tesseract.min.js.map
  3. 2
      examples/file-input/demo.html
  4. 28
      package-lock.json
  5. 8
      scripts/webpack.config.dev.js
  6. 2
      src/browser/index.js

2
dist/tesseract.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/tesseract.min.js.map vendored

File diff suppressed because one or more lines are too long

2
examples/file-input/demo.html

@ -127,7 +127,7 @@ function recognizeFile(file){
<option value='vie' > Vietnamese </option> <option value='vie' > Vietnamese </option>
</select> </select>
<button onclick="recognizeFile('../node/testocr.bmp')">Sample Image</button> <button onclick="recognizeFile('../../tests/assets/images/testocr.png')">Sample Image</button>
<input type="file" onchange="recognizeFile(window.lastFile=this.files[0])"> <input type="file" onchange="recognizeFile(window.lastFile=this.files[0])">
<div id="log"></div> <div id="log"></div>

28
package-lock.json generated

@ -2298,12 +2298,14 @@
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"brace-expansion": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"balanced-match": "^1.0.0", "balanced-match": "^1.0.0",
"concat-map": "0.0.1" "concat-map": "0.0.1"
@ -2318,17 +2320,20 @@
"code-point-at": { "code-point-at": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"concat-map": { "concat-map": {
"version": "0.0.1", "version": "0.0.1",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"console-control-strings": { "console-control-strings": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
@ -2445,7 +2450,8 @@
"inherits": { "inherits": {
"version": "2.0.3", "version": "2.0.3",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"ini": { "ini": {
"version": "1.3.5", "version": "1.3.5",
@ -2457,6 +2463,7 @@
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"number-is-nan": "^1.0.0" "number-is-nan": "^1.0.0"
} }
@ -2471,6 +2478,7 @@
"version": "3.0.4", "version": "3.0.4",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
} }
@ -2478,12 +2486,14 @@
"minimist": { "minimist": {
"version": "0.0.8", "version": "0.0.8",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"minipass": { "minipass": {
"version": "2.2.4", "version": "2.2.4",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"safe-buffer": "^5.1.1", "safe-buffer": "^5.1.1",
"yallist": "^3.0.0" "yallist": "^3.0.0"
@ -2502,6 +2512,7 @@
"version": "0.5.1", "version": "0.5.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"minimist": "0.0.8" "minimist": "0.0.8"
} }
@ -2582,7 +2593,8 @@
"number-is-nan": { "number-is-nan": {
"version": "1.0.1", "version": "1.0.1",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"object-assign": { "object-assign": {
"version": "4.1.1", "version": "4.1.1",
@ -2594,6 +2606,7 @@
"version": "1.4.0", "version": "1.4.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"wrappy": "1" "wrappy": "1"
} }
@ -2715,6 +2728,7 @@
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"code-point-at": "^1.0.0", "code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0", "is-fullwidth-code-point": "^1.0.0",

8
scripts/webpack.config.dev.js

@ -1,4 +1,5 @@
const path = require('path'); const path = require('path');
const webpack = require('webpack');
const genConfig = ({ const genConfig = ({
entry, filename, library, libraryTarget, entry, filename, library, libraryTarget,
@ -10,6 +11,13 @@ const genConfig = ({
library, library,
libraryTarget, libraryTarget,
}, },
plugins: [
new webpack.DefinePlugin({
'process.env': {
TESS_ENV: JSON.stringify('development'),
},
}),
],
}); });
module.exports = [ module.exports = [

2
src/browser/index.js

@ -45,7 +45,7 @@ const loadImage = (image) => {
*/ */
exports.defaultOptions = { exports.defaultOptions = {
...defaultOptions, ...defaultOptions,
workerPath: process.env.NODE_ENV === 'development' workerPath: process.env.TESS_ENV === 'development'
? resolveURL(`/dist/worker.dev.js?nocache=${Math.random().toString(36).slice(3)}`) ? resolveURL(`/dist/worker.dev.js?nocache=${Math.random().toString(36).slice(3)}`)
: `https://cdn.jsdelivr.net/gh/naptha/tesseract.js@v${version}/dist/worker.min.js`, : `https://cdn.jsdelivr.net/gh/naptha/tesseract.js@v${version}/dist/worker.min.js`,
/* /*

Loading…
Cancel
Save