@@ -134,6 +134,10 @@ function buildLazyComponentsJs(components, cb) {
134134 return fs . existsSync ( `./src/core/components/${ component } /${ component } .js` ) ;
135135 } ) ;
136136
137+ const swiperContent = fs . readFileSync (
138+ path . resolve ( __dirname , '../node_modules/swiper/swiper-bundle.js' ) ,
139+ ) ;
140+
137141 rollup ( {
138142 treeshake : false ,
139143 input : componentsToProcess . map (
@@ -144,6 +148,7 @@ function buildLazyComponentsJs(components, cb) {
144148 delimiters : [ '' , '' ] ,
145149 'process.env.NODE_ENV' : JSON . stringify ( env ) , // or 'production'
146150 'process.env.FORMAT' : JSON . stringify ( format ) ,
151+ [ `import Swiper from 'swiper/bundle';` ] : swiperContent ,
147152 } ) ,
148153 nodeResolve ( { mainFields : [ 'module' , 'main' , 'jsnext' ] } ) ,
149154 babel ( { babelHelpers : 'bundled' } ) ,
@@ -229,7 +234,9 @@ function buildLazyComponentsJs(components, cb) {
229234 . replace ( / v a r w i n d o w = g e t W i n d o w \( \) ; / g, '' )
230235 . replace ( / v a r d o c u m e n t = g e t D o c u m e n t \( \) ; / g, '' )
231236 . replace ( / g e t D o c u m e n t \( \) ; / g, 'document' )
232- . replace ( / g e t W i n d o w \( \) ; / g, 'window' ) ;
237+ . replace ( / g e t W i n d o w \( \) ; / g, 'window' )
238+ . replace ( / ( c o n s t | v a r | l e t ) w i n d o w = w i n d o w / g, '' )
239+ . replace ( / ( c o n s t | v a r | l e t ) d o c u m e n t = d o c u m e n t / g, '' ) ;
233240
234241 fileContent = `${ fileIntro } \n ${ fileContent . trim ( ) } ${ outro } ` ;
235242 if ( fileName . indexOf ( 'swiper' ) >= 0 ) {
0 commit comments