build(webpack): make sure we're not bundling same deps twice
As versions of libraries that are both used by swagger-js and swagger-ui may diverge in time, we must use webpack resolve aliases to make sure that only one version of these libraries gets bundled.
This commit is contained in:
@@ -2,6 +2,8 @@
|
|||||||
* @prettier
|
* @prettier
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import path from "path"
|
||||||
|
|
||||||
import configBuilder from "./_config-builder"
|
import configBuilder from "./_config-builder"
|
||||||
|
|
||||||
const result = configBuilder(
|
const result = configBuilder(
|
||||||
@@ -22,6 +24,14 @@ const result = configBuilder(
|
|||||||
output: {
|
output: {
|
||||||
library: "SwaggerUIBundle",
|
library: "SwaggerUIBundle",
|
||||||
},
|
},
|
||||||
|
resolve: {
|
||||||
|
// these aliases make sure that we don't bundle same libraries twice
|
||||||
|
// when the versions of these libraries diverge between swagger-js and swagger-ui
|
||||||
|
alias: {
|
||||||
|
"@babel/runtime-corejs2": path.resolve(__dirname, '..', 'node_modules/@babel/runtime-corejs2'),
|
||||||
|
"js-yaml": path.resolve(__dirname, '..', 'node_modules/js-yaml')
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user