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){ @@ -127,7 +127,7 @@ function recognizeFile(file){
<option value='vie' > Vietnamese </option>
</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])">
<div id="log"></div>

28
package-lock.json generated

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

8
scripts/webpack.config.dev.js

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

2
src/browser/index.js

@ -45,7 +45,7 @@ const loadImage = (image) => { @@ -45,7 +45,7 @@ const loadImage = (image) => {
*/
exports.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)}`)
: `https://cdn.jsdelivr.net/gh/naptha/tesseract.js@v${version}/dist/worker.min.js`,
/*

Loading…
Cancel
Save