@@ -10,6 +10,23 @@ import del from "rollup-plugin-delete"
10
10
import replace from "@rollup/plugin-replace"
11
11
// import { terser } from "rollup-plugin-terser"
12
12
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
+
13
30
export default function makeConfig ( commandOptions ) {
14
31
return [
15
32
{
@@ -25,20 +42,24 @@ export default function makeConfig(commandOptions) {
25
42
plugins : [ autoprefixer ( ) , cssnano ( ) ] ,
26
43
} ) ,
27
44
] ,
45
+ onwarn ( warning , warn ) {
46
+ if ( warning . code === "FILE_NAME_CONFLICT" ) return
47
+ warn ( warning )
48
+ } ,
28
49
} ,
29
50
{
30
51
input : `src/index.tsx` ,
31
52
output : [
32
- {
33
- file : `./dist/index.cjs.js` ,
34
- format : "cjs" ,
35
- } ,
36
53
{
37
54
file : `./dist/index.esm.mjs` ,
38
55
format : "es" ,
39
56
} ,
57
+ {
58
+ file : `./dist/index.cjs.js` ,
59
+ format : "cjs" ,
60
+ } ,
40
61
] ,
41
- // external: ["react "],
62
+ external : [ ... remarkExternal , "shiki "] ,
42
63
plugins : [
43
64
json ( { compact : true } ) ,
44
65
typescript ( {
@@ -58,10 +79,11 @@ export default function makeConfig(commandOptions) {
58
79
format : "es" ,
59
80
} ,
60
81
] ,
61
- // external: ["react"] ,
82
+ external : remarkExternal ,
62
83
plugins : [
63
84
replace ( {
64
85
delimiters : [ "" , "" ] ,
86
+ preventAssignment : true ,
65
87
values : {
66
88
'from "shiki"' :
67
89
'from "shiki/dist/index.browser.mjs"' ,
@@ -88,7 +110,7 @@ export default function makeConfig(commandOptions) {
88
110
format : "es" ,
89
111
} ,
90
112
] ,
91
- // external: ["react"] ,
113
+ external : clientExternal ,
92
114
plugins : [
93
115
json ( { compact : true } ) ,
94
116
typescript ( {
0 commit comments