Skip to content

Commit 7a20266

Browse files
committed
chore: Update kkt config.
1 parent 3bae0c3 commit 7a20266

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

.kktrc.ts

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,25 @@ import path from 'path';
22
import { OptionConf, Webpack, ModuleScopePluginOpts, LoaderOneOf } from 'kkt';
33
import webpack from 'webpack';
44

5-
export const loaderOneOf = [
6-
require.resolve('@kkt/loader-less')
5+
export const loaderOneOf: LoaderOneOf = [
6+
require.resolve('@kkt/loader-less'),
7+
require.resolve('@kkt/loader-raw')
78
];
89

9-
export const moduleScopePluginOpts = [
10+
export const moduleScopePluginOpts: ModuleScopePluginOpts = [
1011
path.resolve(process.cwd(), 'README.md')
1112
];
1213

1314
export default (conf: webpack.Configuration, opts: OptionConf, webpack: Webpack) => {
1415
const pkg = require(path.resolve(process.cwd(), 'package.json'));
15-
// Webpack parses md file text
16-
conf.module!.rules.map((item) => {
17-
if (item.oneOf) {
18-
item.oneOf.unshift({
19-
test: /\.md$/,
20-
use: require.resolve('raw-loader'),
21-
});
22-
}
23-
return item;
24-
});
2516

2617
// Get the project version.
2718
conf.plugins!.push(
2819
new webpack.DefinePlugin({
2920
VERSION: JSON.stringify(pkg.version),
3021
})
3122
);
32-
23+
conf.output = { ...conf.output, publicPath: './' }
3324
return conf;
3425
}
3526

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"doc:dev": "ENTRYDIR=website kkt start",
1414
"build": "npm run ts:build && npm run types:esm && npm run types:cjs && npm run css:build",
1515
"types:build": "tsbb types --sourceRoot src --target ESNEXT",
16+
"watch": "npm run ts:watch & npm run types:watch",
1617
"types:watch": "npm run types:esm -- --watch & npm run types:cjs -- --watch",
1718
"types:esm": "npm run types:build -- --outDir ../lib/esm",
1819
"types:cjs": "npm run types:build -- --outDir ../lib/cjs",
@@ -39,18 +40,18 @@
3940
},
4041
"devDependencies": {
4142
"@kkt/loader-less": "5.8.0",
43+
"@kkt/loader-raw": "5.8.0",
4244
"@types/classnames": "2.2.10",
4345
"@types/react": "16.9.34",
4446
"@types/react-dom": "16.9.6",
4547
"@uiw/react-code-preview": "1.11.4",
4648
"@uiw/react-github-corners": "1.1.3",
49+
"@uiw/react-markdown-preview": "1.0.3",
4750
"@uiw/reset.css": "1.0.3",
4851
"compile-less-cli": "1.4.0",
4952
"kkt": "5.8.0",
50-
"raw-loader": "4.0.1",
5153
"react": "16.13.1",
5254
"react-dom": "16.13.1",
53-
"react-markdown": "4.3.1",
5455
"tsbb": "1.7.0",
5556
"uiw": "3.10.9"
5657
},

0 commit comments

Comments
 (0)