mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +02:00
Remove __pdfjsdev_webpack__, use webpack options
`__pdfjsdev_webpack__` was used to skip evaluating part of an AST, in order to not mangle some `require` symbols. This commit removes `__pdfjsdev_webpack__`, and: - Uses `__non_webpack_require__` when one wants the output to contain `require` instead of `__webpack_require__`. - Adds options to the webpack config to prevent "polyfills" for some Node.js-specific APIs to be added. - Use `// eslint-disable-next-line no-undef` instead of `/* globals ... */` for variables that are not meant to be used globally.
This commit is contained in:
parent
7b4887dd21
commit
742ed3d1c9
5 changed files with 52 additions and 80 deletions
|
@ -12,13 +12,13 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* globals global, process, __pdfjsdev_webpack__ */
|
||||
|
||||
import './compatibility';
|
||||
import { ReadableStream } from '../../external/streams/streams-lib';
|
||||
|
||||
var globalScope =
|
||||
(typeof window !== 'undefined' && window.Math === Math) ? window :
|
||||
// eslint-disable-next-line no-undef
|
||||
(typeof global !== 'undefined' && global.Math === Math) ? global :
|
||||
(typeof self !== 'undefined' && self.Math === Math) ? self : this;
|
||||
|
||||
|
@ -1092,11 +1092,8 @@ function isSpace(ch) {
|
|||
}
|
||||
|
||||
function isNodeJS() {
|
||||
// The if below protected by __pdfjsdev_webpack__ check from webpack parsing.
|
||||
if (typeof __pdfjsdev_webpack__ === 'undefined') {
|
||||
return typeof process === 'object' && process + '' === '[object process]';
|
||||
}
|
||||
return false;
|
||||
// eslint-disable-next-line no-undef
|
||||
return typeof process === 'object' && process + '' === '[object process]';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue