diff options
Diffstat (limited to 'config/esbuild.config.js')
-rw-r--r-- | config/esbuild.config.js | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/config/esbuild.config.js b/config/esbuild.config.js deleted file mode 100644 index b17548d8300..00000000000 --- a/config/esbuild.config.js +++ /dev/null @@ -1,65 +0,0 @@ -const browserslist = require('browserslist'); -const esbuild = require('esbuild'); - -const ESBUILD_SUPPORTED_TARGETS = new Set([ - 'chrome', - 'edge', - 'firefox', - 'hermes', - 'ie', - 'ios', - 'node', - 'opera', - 'rhino', - 'safari', -]); - -const parseBrowserslist = (browserslistResult) => { - return browserslistResult.map((browsers) => { - const [family, version] = browsers.split(' '); - let normalizedVersion = version; - - // browserslist can return a range: safari15.2-15.4 - if (version.indexOf('-') >= -1) { - // we take the lowest version - [normalizedVersion] = version.split('-'); - } - - return { - family, - version: normalizedVersion, - }; - }); -}; - -const mapBrowserslistToESBuildTarget = (browsersList) => { - return parseBrowserslist(browsersList) - .filter(({ family, version }) => { - if (!ESBUILD_SUPPORTED_TARGETS.has(family)) { - console.warning('Unknown ESBuild target %s, version %s', family, version); - return false; - } - - return true; - }) - .map(({ family, version }) => { - return `${family}${version}`; - }); -}; - -module.exports = { - target: mapBrowserslistToESBuildTarget(browserslist()), - supported: { - 'optional-chain': false, - 'nullish-coalescing': false, - 'class-static-field': false, - 'class-field': false, - }, - implementation: esbuild, - /** - * It's necessary to tell esbuild to use the 'js' loader - * because esbuild cannot auto-detect which loader to use - * based on the .vue extension. - */ - loader: 'js', -}; |