Skip to content

Commit e2d8f49

Browse files
build: defines es-version to es2022 also for rollup (#1142)
* Update tsconfig.json * build(turbo): remove cache when rollup-package.config.mjs changes * build(rollup): manually specify target to es2022 for rollup entrypoints as the rollup-plugin-esbuild does not seem to find it correctly in tsconfig --------- Co-authored-by: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com>
1 parent 03bb157 commit e2d8f49

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
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;

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"compilerOptions": {
33
"rootDirs": ["packages"],
4-
"target": "esnext",
4+
"target": "es2022",
55
"module": "esnext",
66
"noEmitOnError": true,
7-
"lib": ["es2020", "dom", "dom.iterable"],
7+
"lib": ["es2022", "dom", "dom.iterable"],
88
"esModuleInterop": false,
99
"declaration": true,
1010
"emitDeclarationOnly": true,

turbo.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
{
22
"$schema": "https://turbo.build/schema.json",
3-
"globalDependencies": ["tsconfig.json", "package.json", "package-lock.json"],
3+
"globalDependencies": [
4+
"tsconfig.json",
5+
"package.json",
6+
"package-lock.json",
7+
"src/rollup-package.config.mjs"
8+
],
49
"tasks": {
510
"build": {
611
"dependsOn": ["^build"],

0 commit comments

Comments
 (0)