Coder Social home page Coder Social logo

kktjs / kkt Goto Github PK

View Code? Open in Web Editor NEW
48.0 2.0 11.0 5.18 MB

Create React apps with no build configuration, Cli tool for creating react apps.

Home Page: https://kktjs.github.io/kkt

License: MIT License

JavaScript 18.55% HTML 13.33% CSS 5.71% TypeScript 54.17% Less 7.40% SCSS 0.38% Stylus 0.34% Shell 0.12%
react cli kkt kkt-cli babel webpack mocker rematch build-tools zero-configuration

kkt's Introduction

KKT LOGO

Build KKT & Example Github issues Github Forks Github Stars Github Releases npm version

Create React apps with no build configuration, Cli tool for creating react apps. Another tool, kkt-ssr, Is a lightweight framework for static and server-rendered applications.

As of KKT 6.x this repo is "lightly" maintained mostly by the community at this point.

Features:

  • ⏱ The code was rewritten using TypeScript.
  • ♻️ Recompile the code when project files get added, removed or modified.
  • 📚 Readable source code that encourages learning and contribution
  • ⚛️ Override create-react-app webpack configs without ejecting
  • 💝 Expose the configuration file entry and support webpack configuration.
  • 🚀 Supports creat-kkt to create different instances.
  • ⛑ Jest test runner setup with defaults kkt test
  • 🐒 Simple CLI for compiling Node.js/Web modules to a single file with @kkt/ncc support.

Usage

You will need Node.js installed on your system.

npm install kkt

Open in CodeSandbox

Open in CodeSandbox

Example

Initialize the project from one of the examples, Let's quickly create a react application:

$ npx create-kkt my-app -e uiw
# or npm
$ npm create kkt my-app -e `<Example Name>`
# or yarn 
$ yarn create kkt my-app -e `<Example Name>`

You can download the following examples directly. Download page.

Tools

@kkt/ncc simple CLI for compiling a Node.js module into a single file. Supports TypeScript.

How to rewire your create-react-app project

Create your app using create-react-app and then rewire it.

npm install kkt --save-dev
"dependencies": {
  ...
-  "react-scripts": "4.0.1",
+  "kkt": "7.0.6",
  ....
},
"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"
},

⚠️ Note: Do NOT flip the call for the eject script. That gets run only once for a project, after which you are given full control over the webpack configuration making kkt no longer required. There are no configuration options to rewire for the eject script.

# Start the Dev Server
$ npm start
# Build your app
$ npm run build

Configuration File

Supports .kktrc.js and .kktrc.ts. @7.5+ above supports .cjs, .mjs, .ts, .js.

.kktrc.js
.kktrc.ts
.kktrc.cjs
.kktrc.mjs
.config/kktrc.js
.config/kktrc.ts
.config/kktrc.cjs
.config/kktrc.mjs
kkt.config.js
kkt.config.ts
kkt.config.cjs
kkt.config.mjs
import express from 'express';
import { Configuration } from 'webpack';
import WebpackDevServer from 'webpack-dev-server';
import { LoaderConfOptions, MockerAPIOptions, DevServerOptions } from 'kkt';

export interface WebpackConfiguration extends Configuration {
  devServer?: WebpackDevServer.Configuration;
  /** Configuring the Proxy Manually */
  proxySetup?: (app: express.Application) => MockerAPIOptions;
}
export declare type KKTRC = {
  proxySetup?: (app: express.Application) => MockerAPIOptions;
  devServer?: (config: WebpackDevServer.Configuration, options: DevServerOptions) => WebpackDevServer.Configuration;
  default?: (conf: WebpackConfiguration, evn: 'development' | 'production', options: LoaderConfOptions) => WebpackConfiguration | Promise<WebpackConfiguration>;
};

Base Configuration Example

import webpack from 'webpack';
import WebpackDevServer from 'webpack-dev-server';
import lessModules from '@kkt/less-modules';
import { LoaderConfOptions, WebpackConfiguration } from 'kkt';

export default (conf: WebpackConfiguration, env: string, options: LoaderConfOptions) => {
  // The Webpack config to use when compiling your react app for development or production.
  // ...add your webpack config
  conf = lessModules(conf, env, options);
  return conf;
}

Modify WebpackDevServer Configuration Example

export const devServer = (config: WebpackDevServer.Configuration) => {
  // Change the https certificate options to match your certificate, using the .env file to
  // set the file paths & passphrase.
  const fs = require('fs');
  config.https = {
    key: fs.readFileSync(process.env.REACT_HTTPS_KEY, 'utf8'),
    cert: fs.readFileSync(process.env.REACT_HTTPS_CERT, 'utf8'),
    ca: fs.readFileSync(process.env.REACT_HTTPS_CA, 'utf8'),
    passphrase: process.env.REACT_HTTPS_PASS
  };
  // Return your customised Webpack Development Server config.
  return config;
};

Configuring the Proxy Manually

import express from 'express';
import { createProxyMiddleware } from 'http-proxy-middleware';
import { LoaderConfOptions, WebpackConfiguration, MockerAPIOptions } from 'kkt';
export default (conf: WebpackConfiguration, evn: 'development' | 'production') => {
  //....
  conf.proxySetup = (app: express.Application): MockerAPIOptions => {
    app.use('/api', createProxyMiddleware({
      target: 'http://localhost:5000',
      changeOrigin: true,
    }));
    return {
      path: path.resolve('./mocker/index.js'),
    };
  };
  return conf;
}

Or use another way to manually configure the proxy.

import express from 'express';
import { createProxyMiddleware } from 'http-proxy-middleware';
import { MockerAPIOptions } from 'kkt';
/**
 * Still available, may be removed in the future. (仍然可用,将来可能会被删除。) 
 */
export const proxySetup = (app: express.Application): MockerAPIOptions => {
  app.use('/api', createProxyMiddleware({
    target: 'http://localhost:5000',
    changeOrigin: true,
  }));
  /**
   * Mocker API Options
   * https://www.npmjs.com/package/mocker-api
   */
  return {
    path: path.resolve('./mocker/index.js'),
    option: {
      proxy: {
        '/repos/(.*)': 'https://api.github.com/',
      },
      changeHost: true,
    }
  }
}

Command Help

Usage: kkt [start|build|test|doc] [--help|h]

  Displays help information.

Options:

  --version, -v           Show version number
  --help, -h              Displays help information.
  --app-src               Specify the entry directory.
  --docs                  Static asset preview in package(Dev mode works).
  --no-open-browser       Do not open in browser.
  --no-clear-console      Do not clear the command line information.

Example:

$ kkt build
$ kkt build --app-src ./website
$ kkt test
$ kkt test --env=jsdom
$ kkt test --env=jsdom --coverage
$ kkt start
$ kkt start --no-open-browser
$ kkt start --watch
$ kkt start --no-clear-console
$ kkt start --app-src ./website
# Static asset preview in "@uiw/doc" package.
# Default preview: http://localhost:3000/_doc/
$ kkt start --docs @uiw/doc/web
# Specify a static website route "_uiw/doc"
# Default preview: http://localhost:3000/_uiw/doc
$ kkt start --docs @uiw/doc/web:_uiw/doc

# Run static services separately
$ kkt doc --path @uiw/doc/web
$ kkt doc --path @uiw/doc/web:_uiw/doc --port 30002
$ kkt doc --path @uiw/doc/web:_uiw/doc -p 30002
$ kkt doc --path ./build/doc -p 30002

Home Page

Add homepage to package.json

The step below is important!

Open your package.json and add a homepage field for your project:

"homepage": "https://myusername.github.io/my-app",

or for a GitHub user page:

"homepage": "https://myusername.github.io",

or for a custom domain page:

"homepage": "https://mywebsite.com",

KKT uses the homepage field to determine the root URL in the built HTML file.

Plugins & Loader

Development

Runs the project in development mode.

# npm run bootstrap
npm run hoist
npm run build

npm run lib:watch
npm run kkt:watch

npm run hoist

Production

Builds the app for production to the build folder.

npm run build

Acknowledgements

@timarney for having created react-app-rewired.

Alternatives

  • rescripts, an alternative framework for extending CRA configurations (supports 2.0+).
  • react-scripts-rewired for a fork of this project that aims to support CRA 2.0
  • craco Create React App Configuration Override, an easy and comprehensible configuration layer for create-react-app.
  • react-app Create React App with server-side code support.
  • create-react-app-esbuild Use esbuild in your create-react-app for faster compilation, development and tests.

Contributors

As always, thanks to our amazing contributors!

Made with contributors.

License

MIT © Kenny Wong

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

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)

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;
}

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;
};

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;
};

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

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)

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 }

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

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

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)

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

配置加载使用 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

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.

  • chore(deps): update dependency electron to v30
  • chore(deps): update dependency husky to v9
  • chore(deps): update dependency lerna to v8
  • fix(deps): update dependency @types/testing-library__jest-dom to v6
  • fix(deps): update dependency @uiw/react-markdown-preview to v5
  • fix(deps): update dependency axios to v1
  • fix(deps): update dependency css-minimizer-webpack-plugin to v7
  • fix(deps): update dependency less-loader to v12
  • fix(deps): update dependency postcss-loader to v8
  • fix(deps): update dependency stylus-loader to v8
  • fix(deps): update dependency web-vitals to v4
  • 🔐 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 v4
  • actions/setup-node v4
  • actions/checkout v4
  • actions/setup-node v4
  • peaceiris/actions-gh-pages v4
  • ncipollo/release-action v1
  • peaceiris/actions-gh-pages v4
  • peaceiris/actions-gh-pages v4
.github/workflows/pr.yml
  • actions/checkout v4
  • actions/setup-node v4
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 ~15.2.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.28.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 ^9.0.11
  • lerna ~7.4.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.63.0
  • stylus-loader ^7.0.0

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

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

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

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.

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.

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.