Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"*.scss"
],
"scripts": {
"start": "cross-env BABEL_MODULES=false webpack-dev-server --inline --hot --config=src-docs/webpack.config.js",
"start": "cross-env BABEL_MODULES=false webpack-dev-server --config=src-docs/webpack.config.js",
"test-docker": "node ./scripts/test-docker.js",
"sync-docs": "node ./scripts/docs-sync.js",
"build-docs": "cross-env BABEL_MODULES=false cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=4096 webpack --config=src-docs/webpack.config.js",
Expand Down Expand Up @@ -118,6 +118,7 @@
"@emotion/eslint-plugin": "^11.0.0",
"@emotion/jest": "^11.1.0",
"@emotion/react": "^11.1.1",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.3",
"@svgr/core": "5.5.0",
"@svgr/plugin-svgo": "^4.0.3",
"@types/classnames": "^2.2.10",
Expand Down Expand Up @@ -206,6 +207,7 @@
"react-dom": "^16.12.0",
"react-helmet": "^6.1.0",
"react-redux": "^7.2.1",
"react-refresh": "^0.11.0",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-router-redux": "^4.0.8",
Expand All @@ -227,9 +229,9 @@
"typescript": "4.1.3",
"uglifyjs-webpack-plugin": "^2.2.0",
"url-loader": "^4.1.0",
"webpack": "^4.44.1",
"webpack": "^4.46.0",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0",
"webpack-dev-server": "^3.11.3",
"yargs": "^17.2.1",
"yeoman-generator": "^4.12.0",
"yo": "^3.1.1"
Expand Down
17 changes: 10 additions & 7 deletions src-docs/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CircularDependencyPlugin = require('circular-dependency-plugin');
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
const babelConfig = require('./.babelrc.js');
// const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');

const getPort = require('get-port');
const deasync = require('deasync');
Expand All @@ -13,6 +13,8 @@ const isDevelopment = WEBPACK_DEV_SERVER === 'true' && CI == null;
const isProduction = NODE_ENV === 'production';
const isPuppeteer = NODE_ENV === 'puppeteer';

const useReactRefresh = isDevelopment && !isPuppeteer;

function employCache(loaders) {
if (isDevelopment && !isPuppeteer) {
return [
Expand All @@ -29,6 +31,10 @@ function employCache(loaders) {
return loaders;
}

if (useReactRefresh) {
babelConfig.plugins.push('react-refresh/babel');
}

const webpackConfig = {
mode: isProduction ? 'production' : 'development',

Expand Down Expand Up @@ -116,12 +122,8 @@ const webpackConfig = {
failOnError: true,
}),

// run TypeScript during webpack build
// new ForkTsCheckerWebpackPlugin({
// typescript: { configFile: path.resolve(__dirname, '..', 'tsconfig.json') },
// async: false, // makes errors more visible, but potentially less performant
// }),
],
useReactRefresh && new ReactRefreshWebpackPlugin(),
].filter(Boolean),

devServer: isDevelopment
? {
Expand All @@ -141,6 +143,7 @@ const webpackConfig = {
ignored: '**/*',
}
: undefined,
hot: true,
}
: undefined,
node: {
Expand Down
Loading