@@ -56,23 +56,9 @@ async function submoduleCoreProd(config: BuildConfig) {
5656 banner : getBanner ( '@qwik.dev/core' , config . distVersion ) ,
5757 } ;
5858
59- const cjsOutput : OutputOptions = {
60- dir : join ( config . distQwikPkgDir ) ,
61- format : 'umd' ,
62- name : 'qwikCore' ,
63- entryFileNames : 'core.cjs' ,
64- sourcemap : true ,
65- globals : {
66- '@qwik.dev/core/build' : 'qwikBuild' ,
67- // not actually used
68- '@qwik.dev/core/preloader' : 'qwikPreloader' ,
69- } ,
70- banner : getBanner ( '@qwik.dev/core' , config . distVersion ) ,
71- } ;
72-
7359 const build = await rollup ( input ) ;
7460
75- await Promise . all ( [ build . write ( esmOutput ) , build . write ( cjsOutput ) ] ) ;
61+ await Promise . all ( [ build . write ( esmOutput ) ] ) ;
7662
7763 console . log ( '🦊 core.mjs:' , await fileSize ( join ( config . distQwikPkgDir , 'core.mjs' ) ) ) ;
7864
@@ -174,13 +160,7 @@ async function submoduleCoreProd(config: BuildConfig) {
174160 console . log ( '🐭 core.min.mjs:' , await fileSize ( join ( config . distQwikPkgDir , 'core.min.mjs' ) ) ) ;
175161
176162 let esmCode = await readFile ( join ( config . distQwikPkgDir , 'core.mjs' ) , 'utf-8' ) ;
177- let cjsCode = await readFile ( join ( config . distQwikPkgDir , 'core.cjs' ) , 'utf-8' ) ;
178- // fixup the Vite base url
179- cjsCode = cjsCode . replaceAll ( 'undefined.BASE_URL' , 'globalThis.BASE_URL||"/"' ) ;
180- await writeFile ( join ( config . distQwikPkgDir , 'core.cjs' ) , cjsCode ) ;
181-
182163 await submoduleCoreProduction ( config , esmCode , join ( config . distQwikPkgDir , 'core.prod.mjs' ) ) ;
183- await submoduleCoreProduction ( config , cjsCode , join ( config . distQwikPkgDir , 'core.prod.cjs' ) ) ;
184164}
185165
186166async function submoduleCoreProduction ( config : BuildConfig , code : string , outPath : string ) {
@@ -238,41 +218,11 @@ async function submoduleCoreDev(config: BuildConfig) {
238218 outExtension : { '.js' : '.mjs' } ,
239219 } ) ;
240220
241- // We do a CJS build, only for the repl service worker
242- const cjs = build ( {
243- ...opts ,
244- // we don't externalize qwik build because then the repl service worker sees require()
245- define : {
246- ...opts . define ,
247- // We need to get rid of the import.meta.env values
248- // Vite's base url
249- 'import.meta.env.BASE_URL' : 'globalThis.BASE_URL' ,
250- // Vite's devserver mode
251- 'import.meta.env.DEV' : 'false' ,
252- } ,
253- format : 'cjs' ,
254- outExtension : { '.js' : '.cjs' } ,
255- banner : {
256- js : `globalThis.qwikCore = (function (module) {` ,
257- } ,
258- footer : {
259- js : `return module.exports; })(typeof module === 'object' && module.exports ? module : { exports: {} });` ,
260- } ,
261- } ) ;
262-
263- await Promise . all ( [ esm , cjs ] ) ;
221+ await Promise . all ( [ esm ] ) ;
264222
265223 // Point the minified and prod versions to the dev versions
266224 await writeFile ( join ( config . distQwikPkgDir , 'core.prod.mjs' ) , `export * from './core.mjs';\n` ) ;
267- await writeFile (
268- join ( config . distQwikPkgDir , 'core.prod.cjs' ) ,
269- `module.exports = require('./core.cjs');\n`
270- ) ;
271225 await writeFile ( join ( config . distQwikPkgDir , 'core.min.mjs' ) , `export * from './core.mjs';\n` ) ;
272- await writeFile (
273- join ( config . distQwikPkgDir , 'core.min.cjs' ) ,
274- `module.exports = require('./core.cjs');\n`
275- ) ;
276226
277227 console . log ( '🐬' , submodule , '(dev)' ) ;
278228}
0 commit comments