Created
May 12, 2021 18:14
-
-
Save sibelius/24f63eef7f43b15dc73c4a0be11bbef8 to your computer and use it in GitHub Desktop.
docusuarus webpack 5 plugin to provide node polyfills
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
plugins: [require.resolve('./sitePlugin')], | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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