Git Product home page Git Product logo

kkt's People

Contributors

dependabot[bot] avatar jaywcjlove avatar liaoyinglong avatar renovate-bot avatar renovate[bot] avatar sunlxy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

kkt's Issues

Failed to parse source map from

Solution 1

"start": "GENERATE_SOURCEMAP=false react-scripts start",

Solution 2

Modify .kktrc.ts config.

import { LoaderConfOptions, WebpackConfiguration } from 'kkt';

export default (conf: WebpackConfiguration, env: 'production' | 'development', options: LoaderConfOptions) => {
  conf.ignoreWarnings = [
    {
      module: /node_modules[\\/]parse5[\\/]/,
    }
  ];
  return conf;
};

TypeError: MiniCssExtractPlugin is not a constructor

KKT:BUILD:ERROR: TypeError: MiniCssExtractPlugin is not a constructor
    at createWebpackConfig (/home/runner/work/react-code-preview/react-code-preview/node_modules/react-scripts/config/webpack.config.js:664:9)
    at _callee$ (/home/runner/work/react-code-preview/react-code-preview/node_modules/kkt/src/scripts/build.ts:31:29)
    at tryCatch (/home/runner/work/react-code-preview/react-code-preview/node_modules/regenerator-runtime/runtime.js:63:40)
    at Generator.invoke [as _invoke] (/home/runner/work/react-code-preview/react-code-preview/node_modules/regenerator-runtime/runtime.js:294:22)
    at Generator.next (/home/runner/work/react-code-preview/react-code-preview/node_modules/regenerator-runtime/runtime.js:119:21)
    at asyncGeneratorStep (/home/runner/work/react-code-preview/react-code-preview/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
    at _next (/home/runner/work/react-code-preview/react-code-preview/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)

Upgrade [email protected].

Solution 1

Solution 2

For anyone else running into this with an app created via kkt, add this to your package.json and then run yarn installagain.

"resolutions": {
  "mini-css-extract-plugin": "~2.4.7
}

Originally posted by @jaywcjlove in #198 (comment)

sourceMap source file does not exist

⚠️ sourceMap source file does not exist. 1

WARNING in ./node_modules/codesandbox-import-utils/lib/api/define.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map 
from '/git-project/@uiw/react/react-codesandbox/node_modules/codesandbox-import-utils/src/api/define.ts' 
file: Error: ENOENT: no such file or directory, 
open '/git-project/@uiw/react/react-codesandbox/node_modules/codesandbox-import-utils/src/api/define.ts'

https://github.com/uiwjs/react-codesandbox/blob/2012811c8a8edcba05ea1498140f72b20d61882d/.kktrc.ts#L23-L28

⚠️ Do not need the following configuration, upgrade kkt to v7.0.3+.

export default (conf: Configuration, env: 'development' | 'production', options: LoaderConfOptions) => {
  // ....
  // ⇣⇣⇣⇣⇣⇣⇣⇣⇣⇣⇣⇣⇣⇣⇣⇣⇣⇣⇣⇣⇣
  if (conf.module && conf.module.rules && conf.module.rules[0]) {
    const rules = conf.module.rules[0];
    if (typeof rules === 'object' && typeof rules.loader === 'string' && /source-map-loader/.test(rules.loader)) {
      ;(conf.module.rules[0] as any).exclude = /((@babel(?:\/|\\{1,2})runtime)|codesandbox-import-utils)/;
    }
  }
  // ⇡⇡⇡⇡⇡⇡⇡⇡⇡⇡⇡⇡⇡⇡⇡⇡⇡⇡⇡⇡⇡⇡
}

Originally posted by @jaywcjlove in #198 (comment)

Footnotes

  1. https://github.com/uiwjs/react-codesandbox/commit/e9d1c020fe5ca4d5a6e20dd60adf596e458f442f

WARNING in DefinePlugin Conflicting values for 'process.env.NODE_ENV'

{
  "scripts": {
    "start": "kkt start",
    //....
  }
}
WARNING in DefinePlugin
Conflicting values for 'process.env.NODE_ENV'

1 WARNING in child compilations (Use 'stats.children: true' resp. '--stats-children' for more details)

1 warning has detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default

Module not found: Error: Can't resolve 'path' in '/home/runner/work/react-color/react-color/node_modules/@babel/core/lib/transformation'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
	- install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "path": false }

Failed to parse source map

⚠️ sourceMap source file does not exist. 1

WARNING in ./node_modules/codesandbox-import-utils/lib/api/define.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map 
from '/git-project/@uiw/react/react-codesandbox/node_modules/codesandbox-import-utils/src/api/define.ts' 
file: Error: ENOENT: no such file or directory, 
open '/git-project/@uiw/react/react-codesandbox/node_modules/codesandbox-import-utils/src/api/define.ts'

https://github.com/uiwjs/react-codesandbox/blob/2012811c8a8edcba05ea1498140f72b20d61882d/.kktrc.ts#L23-L28

⚠️ Do not need the following configuration, upgrade kkt to v7.0.3+.

export default (conf: Configuration, env: 'development' | 'production', options: LoaderConfOptions) => {
  // ....
  // ⇣⇣⇣⇣⇣⇣⇣⇣⇣⇣⇣⇣⇣⇣⇣⇣⇣⇣⇣⇣⇣
  if (conf.module && conf.module.rules && conf.module.rules[0]) {
    const rules = conf.module.rules[0];
    if (typeof rules === 'object' && typeof rules.loader === 'string' && /source-map-loader/.test(rules.loader)) {
      ;(conf.module.rules[0] as any).exclude = /((@babel(?:\/|\\{1,2})runtime)|codesandbox-import-utils)/;
    }
  }
  // ⇡⇡⇡⇡⇡⇡⇡⇡⇡⇡⇡⇡⇡⇡⇡⇡⇡⇡⇡⇡⇡⇡
}

Originally posted by @jaywcjlove in #198 (comment)

Footnotes

  1. https://github.com/uiwjs/react-codesandbox/commit/e9d1c020fe5ca4d5a6e20dd60adf596e458f442f

Error: true is not a PostCSS plugin

⚠️ Upgrade dependency PostCSS to v8
⚠️ Upgrade dependency compile-less-cli to v1.8.11

> kkt build --app-src ./website

Creating an optimized production build...
Failed to compile.

Error: true is not a PostCSS plugin
    at runMicrotasks (<anonymous>)

Originally posted by @jaywcjlove in #198 (comment)

Critical dependency: the request of a dependency is an expression

Creating an optimized production build...
Compiled with warnings.

./node_modules/@babel/standalone/babel.js
Critical dependency: the request of a dependency is an expression

./node_modules/@babel/standalone/babel.js
Critical dependency: the request of a dependency is an expression

临时解决方案

$ CI=false npm run doc
module.exports = {
  //...
  module: {
      exprContextCritical: false
  },
};
export default (conf: Configuration, env: 'development' | 'production', options: LoaderConfOptions) => {

  if (env === 'production') {
    /** https://github.com/uiwjs/react-code-preview/issues/94 */
    conf.module!.exprContextCritical = false;
  }

  return conf;
};

Originally posted by @jaywcjlove in #198 (comment)

Build load *module.less, shows resolve-url-loader warning

resolve-url-loader: webpack misconfiguration
  webpack or the upstream loader did not supply a source-map

Search for the keywords to learn more about each warning.
To ignore, add // eslint-disable-next-line to the line before.

assets by chunk 1.66 MiB (name: main)
  asset static/js/bundle.js 1.65 MiB [emitted] (name: main) 1 related asset
  asset main.54b2d7e2bcb507688e74.hot-update.js 3.53 KiB [emitted] [immutable] [hmr] (name: main) 1 related asset
assets by path *.json 343 bytes
  asset asset-manifest.json 315 bytes [emitted]
  asset main.54b2d7e2bcb507688e74.hot-update.json 28 bytes [emitted] [immutable] [hmr]
asset index.html 1.3 KiB [emitted]
Entrypoint main 1.66 MiB (1.59 MiB) = static/js/bundle.js 1.65 MiB main.54b2d7e2bcb507688e74.hot-update.js 3.53 KiB 2 auxiliary assets
cached modules 1.46 MiB [cached] 123 modules
runtime modules 28.2 KiB 13 modules
../../node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[10].use[1]!../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[10].use[2]!../../node_modules/resolve-url-loader/index.js??ruleSet[1].rules[1].oneOf[10].use[3]!../../node_modules/less-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[10].use[4]!./src/routes/home/index.module.less 547 bytes [built] [code generated] [1 warning]

WARNING in ./src/routes/home/index.module.less (../../node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[10].use[1]!../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[10].use[2]!../../node_modules/resolve-url-loader/index.js??ruleSet[1].rules[1].oneOf[10].use[3]!../../node_modules/less-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[10].use[4]!./src/routes/home/index.module.less)
Module Warning (from ../../node_modules/resolve-url-loader/index.js):
resolve-url-loader: webpack misconfiguration
  webpack or the upstream loader did not supply a source-map
 @ ./src/routes/home/index.module.less 8:6-434 22:17-24 26:7-21 58:25-39 59:36-47 59:50-64 63:6-73:7 64:54-65 64:68-82 70:42-53 70:56-70 72:21-28 83:0-404 83:0-404 84:22-29 84:33-47 84:50-64 61:4-74:5
 @ ./src/routes/home/index.jsx 5:0-41 9:15-29
 @ ./src/routers.jsx 8:0-33 37:34-38 44:34-38
 @ ./src/App.jsx 8:0-35 13:28-34
 @ ./src/index.jsx 7:0-24 12:35-38

1 warning has detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

webpack 5.65.0 compiled with 1 warning in 282 ms

配置加载使用 proload/cosmiconfig 替换

Stars CI NPM version Coverage Status

Github: https://github.com/jaywcjlove/auto-config-loader
Npm: https://www.npmjs.com/package/auto-config-loader

Github: https://github.com/natemoo-re/proload

export async function loaderConf(rcPath: string): Promise<KKTRC> {
let kktrc: KKTRC = {};
const confJsPath = `${rcPath}.js`;
const confTsPath = `${rcPath}.ts`;
try {
if (fs.existsSync(confTsPath)) {
require('ts-node').register(tsOptions);
kktrc = await import(confTsPath);
return kktrc;
}
if (fs.existsSync(confJsPath)) {
require('@babel/register')({
presets: [[require.resolve('babel-preset-react-app'), { runtime: 'classic', useESModules: false }]],
});
kktrc = await import(confJsPath);
}
return kktrc;
} catch (error) {
const message = error && error.message ? error.message : '';
console.log('Invalid \x1b[31;1m .kktrc.js \x1b[0m file.\n', error);
new Error(`Invalid .kktrc.js file. \n ${message}`);
process.exit(1);
}
}

Github: https://github.com/cosmiconfig/cosmiconfig
Npm: https://www.npmjs.com/package/cosmiconfig

lerna bootstrap --hoist doesn't work with create-react-app 5

Plugin "react" was conflicted between "package.json » eslint-config-react-app » /Users/wangchujiang/git-project/kkt/kkt/example/basic/node_modules/eslint-config-react-app/base.js" and "BaseConfig » /Users/wangchujiang/git-project/kkt/kkt/core/node_modules/eslint-config-react-app/base.js".
assets by path static/ 1.5 MiB
  asset static/js/bundle.js 1.49 MiB [emitted] (name: main) 1 related asset
  asset static/js/node_modules_web-vitals_dist_web-vitals_js.chunk.js 6.9 KiB [emitted] 1 related asset
  asset static/media/logo.6ce24c58023cc2f8fd88fe9d219db6c6.svg 2.57 KiB [emitted] (auxiliary name: main)
asset index.html 1.64 KiB [emitted]
asset asset-manifest.json 546 bytes [emitted]
runtime modules 31.3 KiB 15 modules
modules by path ../../core/node_modules/ 264 KiB 81 modules
modules by path ./ 1.11 MiB
  modules by path ./node_modules/ 1.09 MiB
    modules by path ./node_modules/react/ 119 KiB 4 modules
    modules by path ./node_modules/scheduler/ 29.4 KiB 4 modules
    modules by path ./node_modules/react-dom/ 959 KiB 2 modules
    ./node_modules/web-vitals/dist/web-vitals.js 6 KiB [built] [code generated]
    ./node_modules/object-assign/index.js 2.17 KiB [built] [code generated]
  modules by path ./src/ 22.5 KiB
    modules by path ./src/*.css 12.8 KiB 6 modules
    modules by path ./src/*.js 6.11 KiB 3 modules
    ./src/logo.svg 3.61 KiB [built] [code generated]

ERROR in Plugin "react" was conflicted between "package.json » eslint-config-react-app » /Users/wangchujiang/git-project/kkt/kkt/example/basic/node_modules/eslint-config-react-app/base.js" and "BaseConfig » /Users/wangchujiang/git-project/kkt/kkt/core/node_modules/eslint-config-react-app/base.js".

webpack 5.65.0 compiled with 1 error in 4768 ms

Migrate from kkt 5.x to 6.x

老的版本 v5 是将 create-react-app 使用 TypeScript 重新实现了一遍,并添加了配置功能支持,维护成本越来越高,最终 v6 参考 @timarney 开发的 react-app-rewired 已相同的方式实现,虽然在 mocker-api 中使用过类似的玩法,但是没有想到去更改缓存中的内容来实现添加配置。

配置支持 .kktrc.js.kktrc.ts,也可以不配置,将是少量更改的 create-react-app 玩儿法是一样的。

kkt 5.x to 6.x

设置入口目录

- "doc": "cross-env ENTRYDIR=website kkt build",
+ "doc": "kkt build --app-src ./website",

- "start": "cross-env ENTRYDIR=website kkt start",
+ "start": "kkt start --app-src ./website",

配置变得简单

配置依然支持 kktrc.jskktrc.ts 两种配置。

- export const moduleScopePluginOpts = [];
- export const loaderOneOf = [];
- export const mocker = {};
- export function loaderDefault(loader) {
-   return loader;
- }
- export default (conf: webpack.Configuration, options: OptionConf, webpack: typeof webpack) => {
-   return conf;
- }

+ export default (conf: Configuration, env: string, options: LoaderConfOptions) => {
+   return conf;
+ }

+ export const devServer = (configFunction: DevServerConfigFunction) => {
+   return (proxy: WebpackDevServer.ProxyConfigArrayItem[], allowedHost: string) => {
+     // Create the default config by calling configFunction with the proxy/allowedHost parameters
+     const config = configFunction(proxy, allowedHost);
+     return config;
+   }
+ }

Support for Less.

- export const loaderOneOf = [
-   require.resolve('@kkt/loader-less'),
- ];

+ import lessModules from '@kkt/less-modules';
 
export default (conf, env, options) => {
+   conf = lessModules(conf, env, options);
   return conf;
}

Support for scss.

- export const loaderOneOf = [
-   require.resolve('@kkt/loader-scss'),
- ];

Support for stylus.

- export const loaderOneOf = [
-   require.resolve('@kkt/loader-stylus')
- ];
+ import stylusModules from '@kkt/stylus-modules';

export default (conf, env, options) => {
+  conf = stylusModules(conf, env, options);
  return conf;
}

Mocker API

- export const mocker = {
-   path: path.resolve('./mocker/index.js'),
-   option: {
-     proxy: {
-       '/repos/(.*)': 'https://api.github.com/',
-     },
-     changeHost: true,
-   },
- }

+ export const proxySetup = () => {
+   return {
+     path: path.resolve('./mocker/index.js'),
+     option: {
+       proxy: {
+         '/repos/(.*)': 'https://api.github.com/',
+       },
+       changeHost: true,
+     }
+   }
+ }

How to kkt your create-react-app project

npm install kkt --save-dev
"scripts": {
-   "start": "react-scripts start",
+   "start": "kkt start",
-   "build": "react-scripts build",
+   "build": "kkt build",
-   "test": "react-scripts test",
+   "test": "kkt test",
    "eject": "react-scripts eject"
}
# Start the Dev Server
$ npm start
# Build your app
$ npm run build

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

Error: Cannot find module 'ajv/dist/compile/codegen'

Github Actions Error: https://github.com/kktjs/kkt/runs/5314654199?check_suite_focus=true

> @template/[email protected] bundle /git-project/kkt/kkt/example/bundle
> ncc build src/components/button/index.jsx --target web --library Button

internal/modules/cjs/loader.js:905
  throw err;
  ^

Error: Cannot find module 'ajv/dist/compile/codegen'
Require stack:
- /git-project/kkt/kkt/node_modules/ajv-keywords/dist/definitions/typeof.js
- /git-project/kkt/kkt/node_modules/ajv-keywords/dist/keywords/typeof.js
- /git-project/kkt/kkt/node_modules/ajv-keywords/dist/keywords/index.js
- /git-project/kkt/kkt/node_modules/ajv-keywords/dist/index.js
- /git-project/kkt/kkt/node_modules/schema-utils/dist/validate.js
- /git-project/kkt/kkt/node_modules/schema-utils/dist/index.js
- /git-project/kkt/kkt/node_modules/mini-css-extract-plugin/dist/index.js
- /git-project/kkt/kkt/core/lib/plugins/miniCssExtractPlugin.js
- /git-project/kkt/kkt/core/lib/index.js
- /git-project/kkt/kkt/packages/ncc/lib/overrides.js
- /git-project/kkt/kkt/packages/ncc/lib/index.js

"@types/mini-css-extract-plugin": "2.5.0",

kkt@ /git-project/kkt/kkt
└─┬ [email protected]
  └─┬ @lerna/[email protected]
    └─┬ [email protected]
      └─┬ @npmcli/[email protected]
        └─┬ [email protected]
          └─┬ [email protected]
            └─┬ [email protected]
              └── [email protected]

Upgrade ajv@^8.8.0

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • fix(deps): update dependency semver to ~7.6.0
  • chore(deps): update actions/checkout action to v4
  • chore(deps): update actions/setup-node action to v4
  • chore(deps): update dependency @types/node to v20
  • chore(deps): update dependency electron to v29
  • chore(deps): update dependency husky to v9
  • chore(deps): update dependency lerna to v8
  • fix(deps): update dependency @uiw/react-markdown-preview to v5
  • fix(deps): update dependency css-minimizer-webpack-plugin to v6
  • fix(deps): update dependency less-loader to v12
  • fix(deps): update dependency postcss-loader to v8
  • fix(deps): update dependency stylus-loader to v8
  • 🔐 Create all rate-limited PRs at once 🔐

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/ci.yml
  • actions/checkout v3
  • actions/setup-node v3
  • actions/checkout v3
  • actions/setup-node v3
  • peaceiris/actions-gh-pages v3
  • ncipollo/release-action v1
  • peaceiris/actions-gh-pages v3
  • peaceiris/actions-gh-pages v3
.github/workflows/pr.yml
  • actions/checkout v3
  • actions/setup-node v3
npm
core/package.json
  • @babel/plugin-proposal-private-property-in-object ^7.21.11
  • @babel/runtime ^7.18.3
  • @testing-library/jest-dom ^6.0.0
  • @testing-library/react ^14.0.0
  • @testing-library/user-event ^14.0.0
  • @types/fs-extra ~11.0.0
  • @types/minimist ~1.2.2
  • @types/react-dev-utils ~9.0.10
  • @types/semver ~7.5.0
  • @types/testing-library__jest-dom ^5.14.3
  • ajv ^8.8.0
  • auto-config-loader ^1.5.0
  • eslint-config-react-app ^7.0.0
  • fs-extra ~11.1.0
  • minimist ~1.2.6
  • mocker-api ~2.9.5
  • postcss ^8.4.4
  • postcss-flexbugs-fixes ^5.0.2
  • postcss-loader ^7.0.0
  • postcss-normalize ^10.0.1
  • postcss-preset-env ^9.0.0
  • react-scripts >=2.1.3
  • resolve-package-path ~4.0.3
  • sass ^1.45.1
  • semver ~7.5.0
  • typescript ^5.1.3
  • webpack ^5.65.0
  • react-scripts >=2.1.3
  • node >=16.0.0
  • typescript ^5.1.3
example/basic-entry/package.json
  • react ~18.2.0
  • react-dom ~18.2.0
example/basic/package.json
  • react ~18.2.0
  • react-dom ~18.2.0
  • web-vitals ^2.1.4
example/chrome-plugin/package.json
  • react ~18.2.0
  • react-dom ~18.2.0
  • clean-webpack-plugin ~4.0.0
  • filemanager-webpack-plugin ~8.0.0
example/docs/package.json
  • react ~18.2.0
  • react-dom ~18.2.0
  • react-router-dom ^6.16.0
  • web-vitals ^2.1.4
  • @uiw/doc ^4.21.23
  • @uiw/react-native-doc ^4.0.0
example/electron/package.json
  • react ~18.2.0
  • react-dom ~18.2.0
  • @types/react ^18.2.28
  • @types/react-dom ^18.2.13
  • electron ~26.2.0
  • tsbb ^4.1.5
example/less/package.json
  • react ~18.2.0
  • react-dom ~18.2.0
example/markdown/package.json
  • react ~18.2.0
  • react-dom ~18.2.0
example/react-component-tsx/package.json
  • @uiw/react-github-corners ~1.5.14
  • @uiw/react-markdown-preview ~4.1.0
  • react ~18.2.0
  • react-dom ~18.2.0
  • @types/react ^18.2.28
  • @types/react-dom ^18.2.13
  • @types/react-test-renderer ~18.0.0
  • compile-less-cli ~1.9.0
  • husky ~8.0.0
  • lint-staged ~14.0.0
  • prettier ~3.0.0
  • react-test-renderer ~18.2.0
  • tsbb ^4.1.5
  • @babel/runtime >=7.10.0
  • react >=16.9.0
  • react-dom >=16.9.0
example/react-router-ts/package.json
  • react ~18.2.0
  • react-dom ~18.2.0
  • react-router-dom ^6.16.0
  • web-vitals ^2.1.4
  • @testing-library/jest-dom ^6.0.0
  • @testing-library/react ^14.0.0
  • @testing-library/user-event ^14.0.0
  • @types/jest ^27.5.2
  • @types/node ^16.18.58
  • @types/react ^18.2.28
  • @types/react-dom ^18.2.13
example/react-router/package.json
  • axios ~0.27.0
  • react ~18.2.0
  • react-dom ~18.2.0
  • react-router-dom ^6.16.0
example/scss/package.json
  • react ~18.2.0
  • react-dom ~18.2.0
example/stylus/package.json
  • react ~18.2.0
  • react-dom ~18.2.0
example/typescript/package.json
  • react ~18.2.0
  • react-dom ~18.2.0
  • web-vitals ^2.1.4
  • @types/jest ^27.5.2
  • @types/react ^18.2.28
  • @types/react-dom ^18.2.13
example/uiw/package.json
  • @uiw/doc ~4.22.0
  • react ~18.2.0
  • react-dom ~18.2.0
  • uiw ~4.22.0
package.json
  • @babel/runtime ^7.18.3
  • husky ~8.0.0
  • lerna ~7.3.0
  • lint-staged ^15.0.0
  • prettier ~3.0.0
  • tsbb ^4.1.5
  • node >=16.0.0
packages/less-modules/package.json
  • less ^4.1.2
  • less-loader ^10.2.0
packages/raw-modules/package.json
  • raw-loader ^4.0.2
packages/react-library/package.json
  • css-minimizer-webpack-plugin ~3.4.1
packages/resolve-fallback/package.json
  • assert ^2.0.0
  • buffer ^6.0.3
  • crypto-browserify ^3.12.0
  • https-browserify ^1.0.0
  • os ^0.1.2
  • os-browserify ^0.3.0
  • path-browserify ^1.0.1
  • process ^0.11.10
  • stream-browserify ^3.0.0
  • stream-http ^3.2.0
packages/scope-plugin-options/package.json
packages/stylus-modules/package.json
  • stylus ^0.60.0
  • stylus-loader ^7.0.0

  • Check this box to trigger a request for Renovate to run again on this repository

Upgrade react-scripts to v5, Support Webpack 5.x

react-scripts version react-scripts version

Upgrade react-scripts to v5

.kktrc.ts

import webpack, { Configuration } from 'webpack';
import { LoaderConfOptions } from 'kkt';
import { mdCodeModulesLoader } from 'markdown-react-code-preview-loader';
import lessModules from '@kkt/less-modules';
import scopePluginOptions from '@kkt/scope-plugin-options';
import pkg from './package.json';
import path from 'path';

export default (conf: Configuration, env: 'development' | 'production', options: LoaderConfOptions) => {
  conf = lessModules(conf, env, options);
  // Get the project version.
  conf.plugins!.push(
    new webpack.DefinePlugin({
      VERSION: JSON.stringify(pkg.version),
    }),
  );
  // https://github.com/kktjs/kkt/issues/336#issue-1097660932
  conf.module!.exprContextCritical = false;

  conf = scopePluginOptions(conf, env, {
    ...options,
    allowedPaths: [
+      path.resolve(process.cwd(), './node_modules/')
    ]
  });
  /**
   * https://github.com/facebook/react/issues/13991#issuecomment-435587809
   * https://legacy.reactjs.org/warnings/invalid-hook-call-warning.html#duplicate-react
   */
+  if (conf.resolve?.alias) {
+    conf.resolve.alias = {
+      ...conf.resolve.alias,
+      react: path.resolve('./node_modules/react'),
+      'react-dom': path.resolve('./node_modules/react-dom')
+    };
+  }
  conf = mdCodeModulesLoader(conf);
  if (env === 'production') {
    conf.output = { ...conf.output, publicPath: './' };
  }
  return conf;
};

Startup service stuck

kkt start --app-src ./website

Solution:

export default (conf, env, options) => {
  // ....
-  conf.optimization = {
-    ...conf.optimization,
-    splitChunks: {
-      cacheGroups: {
-        refractor: {
-          test: /[\\/]node_modules[\\/](refractor)[\\/]/,
-          name: 'refractor-vendor',
-          chunks: 'all',
-        },
-      },
-    },
-  };
-  conf.output = { ...conf.output, publicPath: './' };
+  if (env === 'production') {
+    conf.optimization = {
+      ...conf.optimization,
+      splitChunks: {
+        cacheGroups: {
+          refractor: {
+            test: /[\\/]node_modules[\\/](refractor)[\\/]/,
+            name: 'refractor-vendor',
+            chunks: 'all',
+          },
+        },
+      },
+    };
+    conf.output = { ...conf.output, publicPath: './' };
+  }
  return conf;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.