@@ -10,6 +10,23 @@ import del from "rollup-plugin-delete"
1010import 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+
1330export 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