Skip to content

Commit

Permalink
fix(troika-worker-utils): pre-transpile the .esm build - issue #84
Browse files Browse the repository at this point in the history
Worker functions can't handle closures, so if Babel is allowed to transpile it
in a way that uses helper functions, it will fail.
  • Loading branch information
lojjic committed Oct 19, 2020
1 parent 0094c84 commit 98248b6
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ const EXTERNAL_GLOBALS = SIBLING_PACKAGES.reduce((out, sib) => {
'object-path': 'objectPath'
})

// Some packages (e.g. those with worker code) we want to transpile in the ESM
// in addition to the UMD:
// TODO make this more fine-grained than the whole package
const TRANSPILE_PACKAGES_FOR_ESM = [
'troika-worker-utils'
]


const onwarn = (warning, warn) => {
// Quiet the 'Use of eval is strongly discouraged' warnings from Yoga lib
Expand Down Expand Up @@ -74,9 +81,9 @@ for (let entry of Object.keys(entries)) {
file: `dist/${outFilePrefix}.esm.js`
},
external: Object.keys(EXTERNAL_GLOBALS),
plugins: [
//buble()
],
plugins: TRANSPILE_PACKAGES_FOR_ESM.includes(LERNA_PACKAGE_NAME) ? [
buble()
] : [],
onwarn
},
// UMD file
Expand Down

0 comments on commit 98248b6

Please sign in to comment.