diff --git a/package-lock.json b/package-lock.json index 10deb8cbe5..57f1d143ef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -47,7 +47,8 @@ "sourcemap-codec": "^1.4.8", "tiny-glob": "^0.2.9", "tslib": "^2.4.1", - "typescript": "^3.7.5" + "typescript": "^3.7.5", + "util": "^0.12.5" }, "engines": { "node": ">= 8" @@ -3070,6 +3071,21 @@ "node": ">=4" } }, + "node_modules/is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", @@ -4935,6 +4951,19 @@ "punycode": "^2.1.0" } }, + "node_modules/util": { + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", + "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", + "dev": true, + "dependencies": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "which-typed-array": "^1.1.2" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -7565,6 +7594,15 @@ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, + "is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, "is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", @@ -9024,6 +9062,19 @@ "punycode": "^2.1.0" } }, + "util": { + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", + "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "which-typed-array": "^1.1.2" + } + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", diff --git a/package.json b/package.json index 52017504a5..04da27a4a4 100644 --- a/package.json +++ b/package.json @@ -153,6 +153,7 @@ "sourcemap-codec": "^1.4.8", "tiny-glob": "^0.2.9", "tslib": "^2.4.1", - "typescript": "^3.7.5" + "typescript": "^3.7.5", + "util": "^0.12.5" } } diff --git a/rollup.config.js b/rollup.config.js index b60423c35c..8ce26f4b84 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -108,8 +108,18 @@ export default [ input: 'src/compiler/index.ts', plugins: [ replace({ - __VERSION__: pkg.version + __VERSION__: pkg.version, + 'process.env.NODE_DEBUG': false // appears inside the util package }), + { + resolveId(id) { + // util is a built-in module in Node.js, but we want a self-contained compiler bundle + // that also works in the browser, so we load its polyfill instead + if (id === 'util') { + return require.resolve('./node_modules/util'); // just 'utils' would resolve this to the built-in module + } + } + }, resolve(), commonjs({ include: ['node_modules/**']