Skip to content

Commit

Permalink
fix: resolve exports field issue causing README.md loading error in d…
Browse files Browse the repository at this point in the history
…ocumentation #692
  • Loading branch information
jaywcjlove committed Oct 24, 2024
1 parent 8f1ff2d commit c2437c7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
11 changes: 2 additions & 9 deletions core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ npm install @uiw/react-codemirror --save

[![Open in CodeSandbox](https://img.shields.io/badge/Open%20in-CodeSandbox-blue?logo=codesandbox)](https://codesandbox.io/embed/react-codemirror-example-codemirror-6-slvju?fontsize=14&hidenavigation=1&theme=dark)

```jsx mdx:preview
```jsx
import React from 'react';
import CodeMirror from '@uiw/react-codemirror';
import { javascript } from '@codemirror/lang-javascript';
Expand Down Expand Up @@ -272,14 +272,7 @@ import { okaidia } from '@uiw/codemirror-theme-okaidia';
const extensions = [javascript({ jsx: true })];

export default function App() {
return (
<CodeMirror
value="console.log('hello world!');"
height="200px"
theme={okaidia}
extensions={extensions}
/>
);
return <CodeMirror value="console.log('hello world!');" height="200px" theme={okaidia} extensions={extensions} />;
}
```

Expand Down
7 changes: 5 additions & 2 deletions core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
"main": "./cjs/index.js",
"module": "./esm/index.js",
"exports": {
"require": "./cjs/index.js",
"import": "./esm/index.js"
".": {
"require": "./cjs/index.js",
"import": "./esm/index.js"
},
"./*": "./*"
},
"scripts": {
"bundle": "ncc build src/index.tsx --target web --filename codemirror && npm run bundle:min",
Expand Down
7 changes: 5 additions & 2 deletions extensions/basic-setup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
"main": "./cjs/index.js",
"module": "./esm/index.js",
"exports": {
"require": "./cjs/index.js",
"import": "./esm/index.js"
".": {
"require": "./cjs/index.js",
"import": "./esm/index.js"
},
"./*": "./*"
},
"scripts": {
"watch": "tsbb watch src/*.ts --use-babel",
Expand Down
7 changes: 3 additions & 4 deletions www/.kktrc.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import webpack, { Configuration } from 'webpack';
import { LoaderConfOptions } from 'kkt';
import webpack from 'webpack';
import { LoaderConfOptions, WebpackConfiguration } from 'kkt';
import lessModules from '@kkt/less-modules';
import rawModules from '@kkt/raw-modules';
import { disableScopePlugin } from '@kkt/scope-plugin-options';
import { mdCodeModulesLoader } from 'markdown-react-code-preview-loader';
import pkg from './package.json';

export default (conf: Configuration, env: 'production' | 'development', options: LoaderConfOptions) => {
export default (conf: WebpackConfiguration, env: 'production' | 'development', options: LoaderConfOptions) => {
conf = lessModules(conf, env, options);
conf = rawModules(conf, env, { ...options, test: /\.(txt)$/i });
conf = mdCodeModulesLoader(conf);
conf = disableScopePlugin(conf);
// Get the project version.
conf.plugins!.push(
new webpack.DefinePlugin({
VERSION: JSON.stringify(pkg.version),
Expand Down

0 comments on commit c2437c7

Please sign in to comment.