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:
66
webpack/dev.babel.js
Normal file
66
webpack/dev.babel.js
Normal file
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
|
||||
import path from "path"
|
||||
import { HotModuleReplacementPlugin } from "webpack"
|
||||
import configBuilder from "./_config-builder"
|
||||
import styleConfig from "./stylesheets.babel"
|
||||
|
||||
const devConfig = configBuilder(
|
||||
{
|
||||
minimize: false,
|
||||
mangle: false,
|
||||
sourcemaps: true,
|
||||
includeDependencies: true,
|
||||
},
|
||||
{
|
||||
mode: "development",
|
||||
entry: {
|
||||
"swagger-ui-bundle": [
|
||||
"./src/polyfills.js", // TODO: remove?
|
||||
"./src/core/index.js",
|
||||
],
|
||||
"swagger-ui-standalone-preset": [
|
||||
"./src/polyfills", // TODO: remove?
|
||||
"./src/standalone/index.js",
|
||||
],
|
||||
"swagger-ui": "./src/style/main.scss",
|
||||
},
|
||||
|
||||
performance: {
|
||||
hints: false
|
||||
},
|
||||
|
||||
output: {
|
||||
library: "[name]",
|
||||
filename: "[name].js",
|
||||
chunkFilename: "[id].js",
|
||||
},
|
||||
|
||||
devServer: {
|
||||
port: 3200,
|
||||
publicPath: "/",
|
||||
disableHostCheck: true, // for development within VMs
|
||||
stats: {
|
||||
colors: true,
|
||||
},
|
||||
hot: true,
|
||||
contentBase: path.join(__dirname, "../", "dev-helpers"),
|
||||
host: "0.0.0.0",
|
||||
},
|
||||
|
||||
plugins: [new HotModuleReplacementPlugin()],
|
||||
}
|
||||
)
|
||||
|
||||
// mix in the style config's plugins and loader rules
|
||||
|
||||
devConfig.plugins = [...devConfig.plugins, ...styleConfig.plugins]
|
||||
|
||||
devConfig.module.rules = [
|
||||
...devConfig.module.rules,
|
||||
...styleConfig.module.rules,
|
||||
]
|
||||
|
||||
export default devConfig
|
||||
Reference in New Issue
Block a user