From 07d346b5169ff18be8170b72404d573eb24be196 Mon Sep 17 00:00:00 2001 From: Tim Lai Date: Tue, 1 Mar 2022 12:08:50 -0800 Subject: [PATCH] feat(build): webpack@5 and webpack-dev-server@4 (#7826) SwaggerUI is now built using `webpack@5`, with dev support for `webpack-dev-server@4` - ES Module output bundle path now points to `swagger-ui-es-bundle-core`, which does not include dependencies - No change to CommonJS output bundle or path - Now uses Asset Modules, which replaces `file-loader`, `raw-loader`, and `url-loader` - Removed unused rules/loaders for `.woff | .woff2 | .ttf | .eot` fonts and html - Node polyfills are no longer bundled with `webpack@5`, and must be loaded separately and/or use `resolve.fallback`. As an example, SwaggerUI loads `process`, `buffer`, and `stream-browserify` as `devDependencies` in order to build development and production bundles. SwaggerUI-React - Now imports `swagger-ui-es-bundle-core`, and similarly outputs `swagger-ui-es-bundle-core` to its `dist` directory Dev notes: - Order of execution matters for the production npm build scripts. `build-stylesheets` needs to get built first, then cleanup of any empty artifacts, before building the various production bundles - `Dev-helpers` now relies on `HTMLWebpackPlugin` to inject css and bundle files --- dev-helpers/index.html | 5 - dist/swagger-ui.js | 4 +- dist/swagger-ui.js.map | 2 +- flavors/swagger-ui-react/index.jsx | 2 +- flavors/swagger-ui-react/release/run.sh | 6 +- .../swagger-ui-react/release/template.json | 7 + package-lock.json | 31371 +++++++++++++--- package.json | 48 +- src/core/plugins/all.js | 4 +- webpack/_config-builder.js | 49 +- webpack/bundle.babel.js | 7 +- webpack/core.babel.js | 5 +- webpack/dev-e2e.babel.js | 78 +- webpack/dev.babel.js | 79 +- webpack/es-bundle-core.babel.js | 7 +- webpack/es-bundle.babel.js | 6 +- webpack/standalone.babel.js | 5 +- webpack/stylesheets.babel.js | 6 - 18 files changed, 27076 insertions(+), 4615 deletions(-) diff --git a/dev-helpers/index.html b/dev-helpers/index.html index 1568962d..2b92c403 100644 --- a/dev-helpers/index.html +++ b/dev-helpers/index.html @@ -5,9 +5,6 @@ Swagger UI - - -