Browse Source

[Beta] Remove some polyfills (#5158)

main
dan 2 years ago
committed by GitHub
parent
commit
e6bc8db08d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      beta/next.config.js
  2. 9
      beta/src/utils/processShim.js
  3. 6
      beta/src/utils/rafShim.js

10
beta/next.config.js

@ -45,8 +45,16 @@ const nextConfig = {
// Don't bundle the shim unnecessarily.
config.resolve.alias['use-sync-external-store/shim'] = 'react';
const {IgnorePlugin} = require('webpack');
const {IgnorePlugin, NormalModuleReplacementPlugin} = require('webpack');
config.plugins.push(
new NormalModuleReplacementPlugin(
/^raf$/,
require.resolve('./src/utils/rafShim.js')
),
new NormalModuleReplacementPlugin(
/^process$/,
require.resolve('./src/utils/processShim.js')
),
new IgnorePlugin({
checkResource(resource, context) {
if (

9
beta/src/utils/processShim.js

@ -0,0 +1,9 @@
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*/
// Used in next.config.js to remove the process transitive dependency.
module.exports = {
env: {},
cwd() {},
};

6
beta/src/utils/rafShim.js

@ -0,0 +1,6 @@
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*/
// Used in next.config.js to remove the raf transitive dependency.
export default window.requestAnimationFrame;
Loading…
Cancel
Save