Adam Shaw 5 rokov pred
rodič
commit
9d983b5b77
1 zmenil súbory, kde vykonal 8 pridanie a 4 odobranie
  1. 8 4
      scripts/lib/rollup-dts.js

+ 8 - 4
scripts/lib/rollup-dts.js

@@ -1,6 +1,6 @@
 const path = require('path')
 const path = require('path')
 const dts = require('rollup-plugin-dts').default
 const dts = require('rollup-plugin-dts').default
-const { isScssPath, isNamedPkg } = require('./rollup-util')
+const { isScssPath, isNamedPkg, isRelPath } = require('./rollup-util')
 const { pkgStructs, pkgStructHash } = require('./pkg-struct')
 const { pkgStructs, pkgStructHash } = require('./pkg-struct')
 const { arrayToHash, copyFile } = require('./util')
 const { arrayToHash, copyFile } = require('./util')
 
 
@@ -63,12 +63,16 @@ module.exports = function() {
         },
         },
         renderChunk(code) {
         renderChunk(code) {
           // HACK. TODO: file bug
           // HACK. TODO: file bug
-          return code.replace(/import\(([^)]*)\)\./, function(m0, m1) {
+          // for weird non-transformed import() statements in dts file
+          return code.replace(/import\(([^)]*)\)\./g, function(m0, m1) {
             let importStr = JSON.parse(m1) // parse the quoted string
             let importStr = JSON.parse(m1) // parse the quoted string
-            if (importStr === './ViewContext') {
+            if (
+              isRelPath(importStr) ||
+              importStr === '@fullcalendar/common'
+            ) {
               return ''
               return ''
             } else {
             } else {
-              throw new Error(`Unknown import('${importStr}'). Could not massage.`)
+              throw new Error(`Unknown import('${importStr}') for hack. Could not massage.`)
             }
             }
           })
           })
         }
         }