From 0151c246004de1c0f3ad944f3da6c70a76a49c7e Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Mon, 4 Nov 2024 00:20:35 +0800 Subject: refactor(build): update build script for addon * To fit file size limit for addon submission of mozilla.org, add scripts for each renderers * add scripts/addon.sh for bundling, with simple rollup commands * scripts/rollup.config.js no more handle addon build --- scripts/rollup.config.js | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) (limited to 'scripts/rollup.config.js') diff --git a/scripts/rollup.config.js b/scripts/rollup.config.js index 547260b..b3a6139 100644 --- a/scripts/rollup.config.js +++ b/scripts/rollup.config.js @@ -6,7 +6,7 @@ import { join } from 'path' import { bundleStats } from 'rollup-plugin-bundle-stats' const prod = process.env.PRODUCTION -const addon = process.env.ADDON +const watch = process.env.ROLLUP_WATCH function resolve (file, origin) { // Your way to resolve local include path @@ -79,31 +79,6 @@ export default [ ] .map(config => ({ ...general, ...config })) .filter(config => { - if (addon) return config.input.match(/dumbymap/) - if (!prod) return config.input.match(/editor/) + if (watch) return config.input.match(/editor/) return true }) - .map(config => { - if (!addon) return config - - config.output.forEach(o => { o.dir = './addon' }) - config.plugins.push({ - name: 'remove-exports', - transform (code, id) { - if (id.includes(config.input)) { - // remove export keyword for addon - const transformedCode = code.replace(/\n(\s*)export\s*/g, '$1') - return { - code: [ - transformedCode, - 'globalThis.generateMaps = generateMaps', - 'globalThis.mapclay = mapclay', - ].join('\n'), - } - } - return null - }, - }) - - return config - }) -- cgit v1.2.3-70-g09d2