Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
stop polyfilling process.browser and modify isBrowserEnvironment check
  • Loading branch information
vincentfretin committed May 20, 2024
commit 97df8c9e7d771cd7d280f759cc0e125d83c62b86
3 changes: 2 additions & 1 deletion src/utils/debug.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var debug = require('debug');
var isBrowserEnvironment = require('./device').isBrowserEnvironment;

var settings = {
colors: {
Expand Down Expand Up @@ -114,6 +115,6 @@ if (ls && (parseInt(ls.logs, 10) || ls.logs === 'true')) {
debug.enable('*:error,*:info,*:warn');
}

if (process.browser) { window.logs = debug; }
if (isBrowserEnvironment) { window.logs = debug; }

module.exports = debug;
3 changes: 1 addition & 2 deletions src/utils/device.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,8 @@ module.exports.isLandscape = function () {
* We need to check a node api that isn't mocked on either side.
* `require` and `module.exports` are mocked in browser by bundlers.
* `window` is mocked in node.
* `process` is also mocked by browserify, but has custom properties.
*/
module.exports.isBrowserEnvironment = !!(!process || process.browser);
module.exports.isBrowserEnvironment = typeof process === 'undefined';

/**
* Check if running in node on the server.
Expand Down
1 change: 0 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ module.exports = {
)
}),
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer']
})
],
Expand Down