Browse Source

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.
bubble
Vladimir Gorej 4 years ago
parent
commit
c30760cfe5
1 changed files with 10 additions and 0 deletions
  1. +10
    -0
      webpack/bundle.babel.js

+ 10
- 0
webpack/bundle.babel.js View File

@@ -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')
},
},
} }
) )




Loading…
Cancel
Save