Skip to content

Commit 19f754f

Browse files
committed
chore: update and simplify rollup configuration
This updates the browser list to be more in line with the official browser support policy of the Google Maps JavaScript API and simplifies the rollup configuration and build process.
1 parent 3f14c1d commit 19f754f

File tree

3 files changed

+17
-22
lines changed

3 files changed

+17
-22
lines changed

.babelrc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
[
44
"@babel/env",
55
{
6-
"targets": {
7-
"browsers": "ie>=11, > 0.25%, not dead"
8-
},
96
"corejs": "3.6",
107
"useBuiltIns": "usage"
118
}

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"prepack": "npm run build",
3636
"lint": "eslint .",
3737
"test": "NODE_OPTIONS='--experimental-vm-modules --disable-warning=ExperimentalWarning' jest ./src",
38-
"build": "rm -rf ./dist && rollup -c && rm -rf ./dist/types",
38+
"build": "rm -rf ./dist && rollup -c",
3939
"format": "eslint . --fix"
4040
},
4141
"dependencies": {
@@ -76,5 +76,9 @@
7676
},
7777
"prettier": {
7878
"trailingComma": "es5"
79-
}
79+
},
80+
"browserslist": [
81+
"last 2 versions",
82+
"not dead"
83+
]
8084
}

rollup.config.js

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,23 @@ const terserOptions = {
2828

2929
const basePlugins = [
3030
typescript({
31+
declaration: false,
3132
tsconfig: "./tsconfig.build.json",
32-
declaration: true,
33-
declarationDir: "dist/types",
34-
}),
35-
nodeResolve({
36-
mainFields: ["browser", "jsnext:main", "module", "main"],
3733
}),
34+
nodeResolve(),
3835
commonjs(),
39-
babel({
40-
extensions: [".js", ".ts"],
41-
babelHelpers: "bundled",
42-
}),
4336
];
4437

4538
export default [
46-
// UMD and browser (iife) builds
39+
// CJS/UMD build
4740
{
4841
input: "src/index.ts",
4942
plugins: [
5043
...basePlugins,
44+
babel({
45+
extensions: [".js", ".ts"],
46+
babelHelpers: "bundled",
47+
}),
5148
replace({
5249
preventAssignment: true,
5350
values: {
@@ -66,16 +63,12 @@ export default [
6663
},
6764
],
6865
},
66+
6967
// ESM build
7068
{
7169
input: "src/index.ts",
7270
plugins: [
73-
typescript({
74-
tsconfig: "./tsconfig.build.json",
75-
declaration: false,
76-
}),
77-
nodeResolve(),
78-
commonjs(),
71+
...basePlugins,
7972
replace({
8073
preventAssignment: true,
8174
values: {
@@ -90,9 +83,10 @@ export default [
9083
exports: "named",
9184
},
9285
},
86+
9387
// types
9488
{
95-
input: "./dist/types/index.d.ts",
89+
input: "src/index.ts",
9690
output: [{ file: "dist/index.d.ts", format: "es" }],
9791
plugins: [dts()],
9892
},

0 commit comments

Comments
 (0)