Skip to content

Commit c30760c

Browse files
committed
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.
1 parent 9420dc8 commit c30760c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

webpack/bundle.babel.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
* @prettier
33
*/
44

5+
import path from "path"
6+
57
import configBuilder from "./_config-builder"
68

79
const result = configBuilder(
@@ -22,6 +24,14 @@ const result = configBuilder(
2224
output: {
2325
library: "SwaggerUIBundle",
2426
},
27+
resolve: {
28+
// these aliases make sure that we don't bundle same libraries twice
29+
// when the versions of these libraries diverge between swagger-js and swagger-ui
30+
alias: {
31+
"@babel/runtime-corejs2": path.resolve(__dirname, '..', 'node_modules/@babel/runtime-corejs2'),
32+
"js-yaml": path.resolve(__dirname, '..', 'node_modules/js-yaml')
33+
},
34+
},
2535
}
2636
)
2737

0 commit comments

Comments
 (0)