Cannot get Elements to work in Docusaurus #1777
Answered
by
vaibhavshn
vaibhavshn
asked this question in
Q&A
|
Hello 👋🏽 I'm on the latest docusaurus version and I'm trying to use the Here's a link to a test repo: Error LogI fixed most of the errors by adding ErrorsWhen running When running Error LogI've used this config to get rid of all other errors except the two ones I've mentioned above: const config = {
plugins: [
// fixes process is not defined error
new webpack.DefinePlugin({
process: {
env: {},
},
}),
],
resolve: {
fallback: {
buffer: require.resolve('buffer'),
events: require.resolve('events'),
stream: require.resolve('stream-browserify'),
// doesn't work in browser when you visit /api
lodash: require.resolve('lodash'),
// build time errors
'@stoplight/http-spec/oas2': false,
'@stoplight/http-spec/oas3': false,
// cannot solve this
'abort-controller': require.resolve('abortcontroller-polyfill'), // also used `abort-controller`
},
},
}; |
Answered by
vaibhavshn
Sep 21, 2021
Replies: 1 comment 14 replies
|
Solved it! Used this webpack config: const config = {
module: {
rules: [
{
test: /\.m?js/,
resolve: {
fullySpecified: false,
},
},
],
},
plugins: [
new ProvidePlugin({
process: require.resolve('process/browser'),
}),
],
resolve: {
fallback: {
buffer: require.resolve('buffer'),
stream: false,
path: false,
process: false,
},
},
}; |
14 replies
Answer selected by
vaibhavshn
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Solved it!
Used this webpack config:
This helped: https://github.com/stoplightio/elements/pull/1640/files/db2a2a547aa4a3b567c02d254ff080c8cdddcfbd#diff-cafe2123a72c4ce3a9f7e9ee4b0e188256eb02d7ec1e54fa2cadfac99b22f92b