Skip to content

Commit f346520

Browse files
committed
Fix rollup warnings
1 parent ab84287 commit f346520

File tree

3 files changed

+37
-8
lines changed

3 files changed

+37
-8
lines changed

examples/docusaurus/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "docusaurus",
2+
"name": "codehike-docusaurus",
33
"version": "0.0.0",
44
"private": true,
55
"scripts": {

packages/mdx/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,12 @@
7878
},
7979
"peerDependencies": {
8080
"react": "^16.8.3 || ^17 || ^18"
81+
},
82+
"repository": "code-hike/codehike",
83+
"license": "MIT",
84+
"homepage": "https://codehike.org",
85+
"funding": {
86+
"type": "github",
87+
"url": "https://github.com/sponsors/code-hike"
8188
}
8289
}

packages/mdx/rollup.config.js

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,23 @@ import del from "rollup-plugin-delete"
1010
import replace from "@rollup/plugin-replace"
1111
// import { terser } from "rollup-plugin-terser"
1212

13+
const clientExternal = [
14+
"react",
15+
"@codesandbox/sandpack-client",
16+
"use-spring",
17+
"diff",
18+
]
19+
const remarkExternal = [
20+
"react",
21+
"node-fetch",
22+
"is-plain-obj",
23+
"unified",
24+
"remark-rehype",
25+
"hast-util-to-estree",
26+
"unist-util-visit-parents",
27+
"unist-util-visit",
28+
]
29+
1330
export default function makeConfig(commandOptions) {
1431
return [
1532
{
@@ -25,20 +42,24 @@ export default function makeConfig(commandOptions) {
2542
plugins: [autoprefixer(), cssnano()],
2643
}),
2744
],
45+
onwarn(warning, warn) {
46+
if (warning.code === "FILE_NAME_CONFLICT") return
47+
warn(warning)
48+
},
2849
},
2950
{
3051
input: `src/index.tsx`,
3152
output: [
32-
{
33-
file: `./dist/index.cjs.js`,
34-
format: "cjs",
35-
},
3653
{
3754
file: `./dist/index.esm.mjs`,
3855
format: "es",
3956
},
57+
{
58+
file: `./dist/index.cjs.js`,
59+
format: "cjs",
60+
},
4061
],
41-
// external: ["react"],
62+
external: [...remarkExternal, "shiki"],
4263
plugins: [
4364
json({ compact: true }),
4465
typescript({
@@ -58,10 +79,11 @@ export default function makeConfig(commandOptions) {
5879
format: "es",
5980
},
6081
],
61-
// external: ["react"],
82+
external: remarkExternal,
6283
plugins: [
6384
replace({
6485
delimiters: ["", ""],
86+
preventAssignment: true,
6587
values: {
6688
'from "shiki"':
6789
'from "shiki/dist/index.browser.mjs"',
@@ -88,7 +110,7 @@ export default function makeConfig(commandOptions) {
88110
format: "es",
89111
},
90112
],
91-
// external: ["react"],
113+
external: clientExternal,
92114
plugins: [
93115
json({ compact: true }),
94116
typescript({

0 commit comments

Comments
 (0)