Skip to content

Instantly share code, notes, and snippets.

@sibelius
Created May 12, 2021 18:14
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sibelius/24f63eef7f43b15dc73c4a0be11bbef8 to your computer and use it in GitHub Desktop.
Save sibelius/24f63eef7f43b15dc73c4a0be11bbef8 to your computer and use it in GitHub Desktop.
docusuarus webpack 5 plugin to provide node polyfills
module.exports = {
plugins: [require.resolve('./sitePlugin')],
}
// eslint-disable-next-line
module.exports = function (context, options) {
return {
name: 'custom-docusaurus-plugin',
// eslint-disable-next-line
configureWebpack(config, isServer, utils) {
return {
resolve: {
alias: {
path: require.resolve('path-browserify'),
},
fallback: {
fs: false,
http: require.resolve('stream-http'),
https: require.resolve('https-browserify'),
os: require.resolve('os-browserify/browser'),
},
},
};
},
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment