-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: refactor builds and include sourcemaps and ts support (#388)
- Loading branch information
Showing
5 changed files
with
1,657 additions
and
195 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,52 @@ | ||
import resolve from '@rollup/plugin-node-resolve'; | ||
import json from '@rollup/plugin-json'; | ||
import json from "@rollup/plugin-json"; | ||
import ts from "rollup-plugin-ts"; | ||
import bundleSize from "rollup-plugin-bundle-size"; | ||
import { terser } from "rollup-plugin-terser"; | ||
|
||
export default { | ||
input: "build/src/index.js", | ||
output: { | ||
file: "build/vega-datasets.js", | ||
format: "umd", | ||
sourcemap: true, | ||
name: "vegaDatasets" | ||
const plugins = (browserslist, declaration) => [ | ||
json(), | ||
ts({ | ||
tsconfig: (resolvedConfig) => ({ | ||
...resolvedConfig, | ||
declaration, | ||
declarationMap: declaration, | ||
}), | ||
transpiler: "babel", | ||
babelConfig: { presets: ["@babel/preset-env"] }, | ||
browserslist, | ||
}), | ||
bundleSize(), | ||
]; | ||
|
||
const outputs = [ | ||
{ | ||
input: "src/index.ts", | ||
output: { | ||
file: "build/vega-datasets.module.js", | ||
format: "esm", | ||
sourcemap: true, | ||
}, | ||
plugins: plugins(undefined, true) | ||
}, | ||
{ | ||
input: "src/index.ts", | ||
output: [ | ||
{ | ||
file: "build/vega-datasets.js", | ||
format: "umd", | ||
sourcemap: true, | ||
name: "vegaDatasets", | ||
}, | ||
{ | ||
file: "build/vega-datasets.min.js", | ||
format: "iife", | ||
sourcemap: true, | ||
name: "vegaDatasets", | ||
plugins: [terser()], | ||
}, | ||
], | ||
plugins: plugins("defaults and not IE 11", false) | ||
}, | ||
plugins: [resolve(), json()] | ||
}; | ||
]; | ||
|
||
export default outputs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.