docs(samples-webpack): updated config and dependencies (#8184)

This commit is contained in:
An Tran
2022-09-21 19:06:52 -04:00
committed by GitHub
parent 6c03465257
commit 82e3290de4
2 changed files with 15 additions and 17 deletions

View File

@@ -9,18 +9,18 @@
"author": "Shaun Luttin", "author": "Shaun Luttin",
"license": "Apache-2.0", "license": "Apache-2.0",
"devDependencies": { "devDependencies": {
"clean-webpack-plugin": "^1.0.1", "clean-webpack-plugin": "^4.0.0",
"copy-webpack-plugin": "^4.6.0", "copy-webpack-plugin": "^11.0.0",
"html-webpack-plugin": "^3.2.0", "html-webpack-plugin": "^5.5.0",
"webpack": "^4.29.3", "webpack": "^5.74.0",
"webpack-cli": "^3.2.3", "webpack-cli": "^4.10.0",
"webpack-dev-server": "^3.1.14" "webpack-dev-server": "^4.11.0"
}, },
"dependencies": { "dependencies": {
"css-loader": "^2.1.0", "css-loader": "^6.7.1",
"json-loader": "^0.5.7", "json-loader": "^0.5.7",
"style-loader": "^0.23.1", "style-loader": "^3.3.1",
"swagger-ui": "^3.20.7", "swagger-ui": "^4.14.0",
"yaml-loader": "^0.5.0" "yaml-loader": "^0.8.0"
} }
} }

View File

@@ -1,6 +1,6 @@
const path = require('path'); const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin'); const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin'); const CopyWebpackPlugin = require('copy-webpack-plugin');
const outputPath = path.resolve(__dirname, 'dist'); const outputPath = path.resolve(__dirname, 'dist');
@@ -19,7 +19,7 @@ module.exports = {
test: /\.yaml$/, test: /\.yaml$/,
use: [ use: [
{ loader: 'json-loader' }, { loader: 'json-loader' },
{ loader: 'yaml-loader' } { loader: 'yaml-loader', options:{ asJSON: true } }
] ]
}, },
{ {
@@ -32,17 +32,15 @@ module.exports = {
] ]
}, },
plugins: [ plugins: [
new CleanWebpackPlugin([ new CleanWebpackPlugin(),
outputPath new CopyWebpackPlugin({patterns:[
]),
new CopyWebpackPlugin([
{ {
// Copy the Swagger OAuth2 redirect file to the project root; // Copy the Swagger OAuth2 redirect file to the project root;
// that file handles the OAuth2 redirect after authenticating the end-user. // that file handles the OAuth2 redirect after authenticating the end-user.
from: require.resolve('swagger-ui/dist/oauth2-redirect.html'), from: require.resolve('swagger-ui/dist/oauth2-redirect.html'),
to: './' to: './'
} }
]), ]}),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: 'index.html' template: 'index.html'
}) })