housekeeping: upgrade to webpack@4 (via #5454)

* build new core webpack config

* fix exports in Webpack; use ESM syntax throughout

* add bundle config

* add standalone config

* add style config

* prettier...

* add dev config

* delete legacy webpack scripts

* rewire npm scripts to use new webpack configs

* cache babel-loader results

* fix e2e dev servers

* update core Webpack modules

* update loaders to latest

* remove unused loaders

* update Webpack plugins

* add mode flags to Webpack configs

* remove plugin invocations that are now production-standard in v4

* update webpack-cli

* add webpack perf size limit flags

* replace ExtractText with MiniCssExtract + IgnoreAssets

* UglifyJsPlugin -> TerserPlugin

* fix PostCSS processing

* enable Terser sourcemaps

* webpack/style -> webpack/stylesheets
This commit is contained in:
kyle
2019-07-11 18:57:44 -05:00
committed by GitHub
parent 9935ea3328
commit 88204daad8
23 changed files with 5176 additions and 5520 deletions

View File

@@ -1,15 +1,10 @@
// This file uses CommonJS require/exports syntax in order to export the SwaggerUI
// function directly, instead of `{ default: fn SwaggerUI }`, which Babel would
// generate if we used ESM syntax.
const deepExtend = require("deep-extend")
const System = require("core/system").default
const ApisPreset = require("core/presets/apis").default
const AllPlugins = require("core/plugins/all").default
const { parseSearch } = require("core/utils")
const win = require("core/window")
import deepExtend from "deep-extend"
import System from "./system"
import ApisPreset from "./presets/apis"
import AllPlugins from "./plugins/all"
import { parseSearch } from "./utils"
import win from "./window"
if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") {
win.Perf = require("react-dom/lib/ReactPerf")
@@ -18,7 +13,7 @@ if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") {
// eslint-disable-next-line no-undef
const { GIT_DIRTY, GIT_COMMIT, PACKAGE_VERSION, HOSTNAME, BUILD_TIME } = buildInfo
module.exports = function SwaggerUI(opts) {
export default function SwaggerUI(opts) {
win.versions = win.versions || {}
win.versions.swaggerUi = {
@@ -191,9 +186,9 @@ module.exports = function SwaggerUI(opts) {
}
// Add presets
module.exports.presets = {
SwaggerUI.presets = {
apis: ApisPreset,
}
// All Plugins
module.exports.plugins = AllPlugins
SwaggerUI.plugins = AllPlugins