Skip to content

Commit

Permalink
Fix bundle size issue
Browse files Browse the repository at this point in the history
  • Loading branch information
relliv committed Nov 4, 2024
1 parent a7aefc7 commit 89f8af4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 21 deletions.
2 changes: 1 addition & 1 deletion libs/utils/nx-calendar-heatmap-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ngeenx/nx-calendar-heatmap-utils",
"version": "1.0.1",
"version": "1.0.2",
"description": "NX Calendar Heatmap component utils",
"keywords": [
"calendar utils",
Expand Down
48 changes: 28 additions & 20 deletions libs/utils/nx-calendar-heatmap-utils/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
/// <reference types='vitest' />
import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';
import * as path from 'path';
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
import { defineConfig } from "vite";
import dts from "vite-plugin-dts";
import * as path from "path";
import { nxViteTsPaths } from "@nx/vite/plugins/nx-tsconfig-paths.plugin";
import { nxCopyAssetsPlugin } from "@nx/vite/plugins/nx-copy-assets.plugin";

export default defineConfig({
root: __dirname,
cacheDir: '../../../node_modules/.vite/libs/utils/nx-calendar-heatmap-utils',
cacheDir: "../../../node_modules/.vite/libs/utils/nx-calendar-heatmap-utils",
plugins: [
nxViteTsPaths(),
nxCopyAssetsPlugin(['*.md']),
nxCopyAssetsPlugin(["*.md"]),
dts({
entryRoot: 'src',
tsconfigPath: path.join(__dirname, 'tsconfig.lib.json'),
entryRoot: "src",
tsconfigPath: path.join(__dirname, "tsconfig.lib.json"),
}),
],
// Uncomment this if you are using workers.
Expand All @@ -23,36 +23,44 @@ export default defineConfig({
// Configuration for building your library.
// See: https://vitejs.dev/guide/build.html#library-mode
build: {
outDir: '../../../dist/libs/utils/nx-calendar-heatmap-utils',
outDir: "../../../dist/libs/utils/nx-calendar-heatmap-utils",
emptyOutDir: true,
reportCompressedSize: true,
commonjsOptions: {
transformMixedEsModules: true,
},
lib: {
// Could also be a dictionary or array of multiple entry points.
entry: 'src/index.ts',
name: 'nx-calendar-heatmap-utils',
fileName: 'index',
entry: "src/index.ts",
name: "nx-calendar-heatmap-utils",
fileName: "index",
// Change this to the formats you want to support.
// Don't forget to update your package.json as well.
formats: ['es', 'cjs'],
formats: ["es", "cjs"],
},
rollupOptions: {
// External packages that should not be bundled into your library.
external: [],
external: ["tippy.js", "luxon"],
output: {
// Provide global variables to use in the UMD build
// for externalized deps
globals: {
"tippy.js": "tippy",
luxon: "luxon",
},
},
},
},
test: {
watch: false,
globals: true,
environment: 'node',
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
reporters: ['default'],
environment: "node",
include: ["src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
reporters: ["default"],
coverage: {
reportsDirectory:
'../../../coverage/libs/utils/nx-calendar-heatmap-utils',
provider: 'v8',
"../../../coverage/libs/utils/nx-calendar-heatmap-utils",
provider: "v8",
},
},
});

0 comments on commit 89f8af4

Please sign in to comment.