Skip to content

Commit

Permalink
feat: add vite config 🎉
Browse files Browse the repository at this point in the history
Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>
  • Loading branch information
vinayakkulkarni committed Oct 27, 2022
1 parent adbfa8f commit ba3fc07
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { resolve } from 'path';
import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';
import pkg from './package.json';

const banner = `/*!
* ${pkg.name} v${pkg.version}
* ${pkg.description}
* (c) 2021 ${pkg.author.name}<${pkg.author.email}>
* Released under the ${pkg.license} License
*/
`;

export default defineConfig({
build: {
target: 'esnext',
sourcemap: true,
reportCompressedSize: true,
lib: {
entry: resolve(__dirname, 'src/index.ts'),
name: 'MapboxGlInterpolateHeatmap',
formats: ['es', 'cjs', 'umd'],
fileName: pkg.name,
},
commonjsOptions: {
extensions: ['.js', '.ts'],
strictRequires: true,
exclude: 'src/**',
include: 'node_modules/**',
},
rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into your library
external: ['mapbox-gl', 'earcut'],
output: {
banner,
exports: 'named',
strict: true,
sourcemap: true,
extend: true,
// Provide global variables to use in the UMD build
// for externalized deps
globals: {
earcut: 'earcut',
'mapbox-gl': 'mapboxgl',
},
},
},
},
plugins: [
dts({
outputDir: ['dist'],
}),
],
});

0 comments on commit ba3fc07

Please # to comment.