Skip to content

Commit c2437c7

Browse files
committed
fix: resolve exports field issue causing README.md loading error in documentation #692
1 parent 8f1ff2d commit c2437c7

File tree

4 files changed

+15
-17
lines changed

4 files changed

+15
-17
lines changed

core/README.md

+2-9
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ npm install @uiw/react-codemirror --save
9898

9999
[![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)
100100

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

274274
export default function App() {
275-
return (
276-
<CodeMirror
277-
value="console.log('hello world!');"
278-
height="200px"
279-
theme={okaidia}
280-
extensions={extensions}
281-
/>
282-
);
275+
return <CodeMirror value="console.log('hello world!');" height="200px" theme={okaidia} extensions={extensions} />;
283276
}
284277
```
285278

core/package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@
99
"main": "./cjs/index.js",
1010
"module": "./esm/index.js",
1111
"exports": {
12-
"require": "./cjs/index.js",
13-
"import": "./esm/index.js"
12+
".": {
13+
"require": "./cjs/index.js",
14+
"import": "./esm/index.js"
15+
},
16+
"./*": "./*"
1417
},
1518
"scripts": {
1619
"bundle": "ncc build src/index.tsx --target web --filename codemirror && npm run bundle:min",

extensions/basic-setup/package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@
99
"main": "./cjs/index.js",
1010
"module": "./esm/index.js",
1111
"exports": {
12-
"require": "./cjs/index.js",
13-
"import": "./esm/index.js"
12+
".": {
13+
"require": "./cjs/index.js",
14+
"import": "./esm/index.js"
15+
},
16+
"./*": "./*"
1417
},
1518
"scripts": {
1619
"watch": "tsbb watch src/*.ts --use-babel",

www/.kktrc.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
import webpack, { Configuration } from 'webpack';
2-
import { LoaderConfOptions } from 'kkt';
1+
import webpack from 'webpack';
2+
import { LoaderConfOptions, WebpackConfiguration } from 'kkt';
33
import lessModules from '@kkt/less-modules';
44
import rawModules from '@kkt/raw-modules';
55
import { disableScopePlugin } from '@kkt/scope-plugin-options';
66
import { mdCodeModulesLoader } from 'markdown-react-code-preview-loader';
77
import pkg from './package.json';
88

9-
export default (conf: Configuration, env: 'production' | 'development', options: LoaderConfOptions) => {
9+
export default (conf: WebpackConfiguration, env: 'production' | 'development', options: LoaderConfOptions) => {
1010
conf = lessModules(conf, env, options);
1111
conf = rawModules(conf, env, { ...options, test: /\.(txt)$/i });
1212
conf = mdCodeModulesLoader(conf);
1313
conf = disableScopePlugin(conf);
14-
// Get the project version.
1514
conf.plugins!.push(
1615
new webpack.DefinePlugin({
1716
VERSION: JSON.stringify(pkg.version),

0 commit comments

Comments
 (0)