Skip to content

Commit fbe74e6

Browse files
committed
build(rollup): manually specify target to es2022 for rollup entrypoints as the rollup-plugin-esbuild does not seem to find it correctly in tsconfig
1 parent f1c4528 commit fbe74e6

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

packages/rollup-package.config.mjs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@ import importCss from 'rollup-plugin-import-css';
1515
import properties from './uui-css/custom-properties.module.js'; // eslint-disable-line
1616
// @ts-ignore-end
1717

18-
const esbuidOptions = { minify: true };
18+
const tsconfigPath = new URL('../tsconfig.json', import.meta.url).pathname;
19+
20+
/**
21+
* @type {import('rollup-plugin-esbuild').Options}
22+
*/
23+
const esbuildOptions = { tsconfig: tsconfigPath, target: 'es2022' }; // TODO: We have to specify the 'target' manually here, because the tsconfig is not used correctly by rollup-plugin-esbuild
1924

2025
const rootDir = new URL('../', import.meta.url).pathname;
2126

@@ -32,7 +37,7 @@ const createEsModulesConfig = (entryPoints = []) => {
3237
plugins: [
3338
nodeResolve({ rootDir }),
3439
importCss({ from: undefined }),
35-
esbuild(),
40+
esbuild(esbuildOptions),
3641
processLitCSSPlugin(),
3742
],
3843
};
@@ -84,7 +89,10 @@ const createBundleConfig = (bundle, namespace) => {
8489
importCss(),
8590
processLitCSSPlugin(),
8691
minifyHTML.default(),
87-
esbuild(esbuidOptions),
92+
esbuild({
93+
...esbuildOptions,
94+
minify: true,
95+
}),
8896
],
8997
}
9098
: undefined;

0 commit comments

Comments
 (0)