Skip to content

Commit

Permalink
chore: try to use js webpack config
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexVarchuk committed Apr 25, 2024
1 parent 59b5614 commit 0512baf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
6 changes: 1 addition & 5 deletions config/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,14 @@ RUN apk update && apk add --no-cache git
# Install dependencies
WORKDIR /build
COPY package.json package-lock.json /build/
RUN npm ci --no-optional --ignore-scripts
RUN npm ci --ignore-scripts

# copy only required for the build files
COPY src /build/src
COPY webpack.config.ts tsconfig.json custom.d.ts /build/
COPY config/webpack-utils.ts /build/config/
COPY typings/styled-patch.d.ts /build/typings/styled-patch.d.ts

RUN npm install --save-dev typescript ts-node @types/node @types/webpack

RUN npm install --save-dev @types/webpack-dev-server

RUN npm run bundle:standalone

FROM nginx:alpine
Expand Down
6 changes: 3 additions & 3 deletions config/webpack-utils.ts → config/webpack-utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as webpack from 'webpack';
const webpack = require('webpack');

export function webpackIgnore(regexp) {
module.exports = function webpackIgnore(regexp) {
return new webpack.NormalModuleReplacementPlugin(regexp, require.resolve('lodash.noop'));
}
};
11 changes: 6 additions & 5 deletions webpack.config.ts → webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* tslint:disable:no-implicit-dependencies */
import ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
import * as webpack from 'webpack';
import * as path from 'path';
import { webpackIgnore } from './config/webpack-utils';
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const webpack = require('webpack');
const path = require('path');
// eslint-disable-next-line import/no-internal-modules
const webpackIgnore = require('./config/webpack-utils');

const nodeExternals = require('webpack-node-externals')({
// bundle in modules that need transpiling + non-js (e.g. css)
Expand Down Expand Up @@ -33,7 +34,7 @@ const BANNER = `ReDoc - OpenAPI/Swagger-generated API Reference Documentation
Version: ${VERSION}
Repo: https://github.com/Redocly/redoc`;

export default (env: { standalone?: boolean; browser?: boolean } = {}) => ({
module.exports = (env = {}) => ({
entry: env.standalone ? ['./src/polyfills.ts', './src/standalone.tsx'] : './src/index.ts',
output: {
filename: env.standalone
Expand Down

0 comments on commit 0512baf

Please sign in to comment.