chore: rolled back webpack.config(s) to previous version

This commit is contained in:
Andriy Leliv 2021-04-06 13:08:57 +03:00
parent 3789c506c8
commit c015bfd977
4 changed files with 3457 additions and 5828 deletions

View File

@ -2,14 +2,18 @@ import * as CopyWebpackPlugin from 'copy-webpack-plugin';
import ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
import * as HtmlWebpackPlugin from 'html-webpack-plugin';
import { compact } from 'lodash';
import { resolve } from 'path';
import * as webpack from 'webpack';
import { root } from '../webpack.config';
const VERSION = JSON.stringify(require('../package.json').version);
const REVISION = JSON.stringify(
require('child_process').execSync('git rev-parse --short HEAD').toString().trim(),
);
function root(filename) {
return resolve(__dirname + '/' + filename);
}
const tsLoader = (env) => ({
loader: 'ts-loader',
options: {
@ -44,18 +48,18 @@ const babelHotLoader = {
export default (env: { playground?: boolean; bench?: boolean } = {}, { mode }) => ({
entry: [
root('src/polyfills.ts'),
root('../src/polyfills.ts'),
root(
env.playground
? 'demo/playground/hmr-playground.tsx'
? 'playground/hmr-playground.tsx'
: env.bench
? 'benchmark/index.tsx'
: 'demo/index.tsx',
? '../benchmark/index.tsx'
: 'index.tsx',
),
],
output: {
filename: 'redoc-demo.bundle.js',
path: root('demo/dist'),
path: root('dist'),
globalObject: 'this',
},
@ -69,12 +73,20 @@ export default (env: { playground?: boolean; bench?: boolean } = {}, { mode }) =
resolve: {
extensions: ['.ts', '.tsx', '.js', '.json'],
alias: {
fs: root('fs.mock.js'),
...(mode !== 'production' && { 'react-dom': '@hot-loader/react-dom' })
alias:
mode !== 'production'
? {
'react-dom': '@hot-loader/react-dom',
}
: {},
},
node: {
fs: 'empty',
},
performance: false,
externals: {
esprima: 'esprima',
'node-fetch': 'null',

View File

@ -1,6 +0,0 @@
module.exports = {
promises: {
readFile () {}
},
existsSync () {},
}

9222
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,6 @@
import ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
import * as webpack from 'webpack';
import * as path from 'path';
import { resolve } from 'path';
const nodeExternals = require('webpack-node-externals')({
// bundle in modules that need transpiling + non-js (e.g. css)
@ -32,11 +31,6 @@ const BANNER = `ReDoc - OpenAPI/Swagger-generated API Reference Documentation
Version: ${VERSION}
Repo: https://github.com/Redocly/redoc`;
export function root(filename) {
return resolve(__dirname + '/' + filename);
}
export default (env: { standalone?: boolean } = {}, { mode }) => ({
entry: env.standalone ? ['./src/polyfills.ts', './src/standalone.tsx'] : './src/index.ts',
output: {
@ -49,15 +43,14 @@ export default (env: { standalone?: boolean } = {}, { mode }) => ({
devtool: 'source-map',
resolve: {
extensions: ['.ts', '.tsx', '.js', '.json'],
alias: {
fs: root('fs.mock.js')
}
},
node: {
fs: 'empty',
},
performance: false,
optimization: {
minimize: !!env.standalone,
},
externals: env.standalone
? {
esprima: 'esprima',