Files
swagger-ui/webpack/bundle.babel.js
Vladimir Gorej c30760cfe5 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.
2020-06-29 14:19:38 +02:00

39 lines
835 B
JavaScript

/**
* @prettier
*/
import path from "path"
import configBuilder from "./_config-builder"
const result = configBuilder(
{
minimize: true,
mangle: true,
sourcemaps: true,
includeDependencies: true,
},
{
entry: {
"swagger-ui-bundle": [
"./src/polyfills.js", // TODO: remove?
"./src/core/index.js",
],
},
output: {
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')
},
},
}
)
export default result