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
77 lines
1.6 KiB
JavaScript
77 lines
1.6 KiB
JavaScript
/**
|
|
* @prettier
|
|
*/
|
|
|
|
import path from "path"
|
|
|
|
import configBuilder from "./_config-builder"
|
|
import styleConfig from "./stylesheets.babel"
|
|
|
|
// Pretty much the same as devConfig, but with changes to port and static.directory
|
|
const devE2eConfig = configBuilder(
|
|
{
|
|
minimize: false,
|
|
mangle: false,
|
|
sourcemaps: true,
|
|
includeDependencies: true,
|
|
},
|
|
{
|
|
mode: "development",
|
|
entry: {
|
|
"swagger-ui-bundle": [
|
|
"./src/core/index.js",
|
|
],
|
|
"swagger-ui-standalone-preset": [
|
|
"./src/standalone/index.js",
|
|
],
|
|
"swagger-ui": "./src/style/main.scss",
|
|
},
|
|
|
|
performance: {
|
|
hints: false
|
|
},
|
|
|
|
output: {
|
|
filename: "[name].js",
|
|
chunkFilename: "[id].js",
|
|
library: {
|
|
name: "[name]",
|
|
export: "default",
|
|
},
|
|
publicPath: "/",
|
|
},
|
|
|
|
devServer: {
|
|
allowedHosts: "all", // for development within VMs
|
|
headers: {
|
|
"Access-Control-Allow-Origin": "*",
|
|
"Access-Control-Allow-Methods": "*",
|
|
"Access-Control-Allow-Headers": "*",
|
|
},
|
|
port: 3230,
|
|
host: "0.0.0.0",
|
|
hot: true,
|
|
static: {
|
|
directory: path.join(__dirname, "../", "test", "e2e-cypress", "static"),
|
|
publicPath: "/",
|
|
},
|
|
client: {
|
|
logging: "info",
|
|
progress: true,
|
|
},
|
|
devMiddleware: {},
|
|
},
|
|
},
|
|
)
|
|
|
|
// mix in the style config's plugins and loader rules
|
|
|
|
devE2eConfig.plugins = [...devE2eConfig.plugins, ...styleConfig.plugins]
|
|
|
|
devE2eConfig.module.rules = [
|
|
...devE2eConfig.module.rules,
|
|
...styleConfig.module.rules,
|
|
]
|
|
|
|
export default devE2eConfig
|