Skip to content

Commit

Permalink
build(rollup-plugin): Bundle with rollup
Browse files Browse the repository at this point in the history
  • Loading branch information
vio committed Jan 21, 2025
1 parent 01ea430 commit 3920908
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 7 deletions.
67 changes: 67 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions packages/rollup-plugin/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@ Thumbs.db
*.sublime-workspace
*.log
yarn.lock
lib
lib-esm
types
dist
15 changes: 12 additions & 3 deletions packages/rollup-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@
"name": "rollup-plugin-bundle-stats",
"version": "4.18.0",
"description": "In-depth bundle analyzer for rollup(bundle size, assets, modules, packages)",
"main": "lib/index.js",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "types/index.d.ts",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs",
"types": "./dist/index.d.ts"
}
},
"sideEffects": false,
"engines": {
"node": ">= 16.0"
Expand All @@ -12,8 +20,8 @@
"lib": "lib"
},
"scripts": {
"build": "npm run clean && tsc --rootDir ./src --project tsconfig.json --outDir ./lib",
"clean": "rimraf lib types",
"build": "npm run clean && rollup -c",
"clean": "rimraf dist",
"lint": "eslint",
"test:package": "cd test/package && npm test --"
},
Expand Down Expand Up @@ -49,6 +57,7 @@
"rollup-plugin-webpack-stats": "2.0.0"
},
"devDependencies": {
"@rollup/plugin-typescript": "^12.1.2",
"@tsconfig/node16": "16.1.3",
"@types/jest": "29.5.14",
"core-js": "3.40.0",
Expand Down
27 changes: 27 additions & 0 deletions packages/rollup-plugin/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { defineConfig } from 'rollup';
import typescript from '@rollup/plugin-typescript';

export default defineConfig([
{
input: './src/index.ts',
output: {
dir: './dist',
format: 'esm',
entryFileNames: '[name].mjs',
chunkFileNames: 'chunks/[name].mjs',
sourcemap: true,
},
plugins: [typescript({ tsconfig: './tsconfig.json' })],
},
{
input: './src/index.ts',
output: {
dir: './dist',
format: 'commonjs',
entryFileNames: '[name].cjs',
chunkFileNames: 'chunks/[name].cjs',
sourcemap: true,
},
plugins: [typescript({ tsconfig: './tsconfig.json' })],
},
]);
3 changes: 2 additions & 1 deletion packages/rollup-plugin/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
"extends": "@tsconfig/node16/tsconfig.json",
"compilerOptions": {
"noEmit": false,
"module": "Node16",
"declaration": true,
"declarationDir": "./types",
"declarationDir": "./dist",
},
"include": ["src/**/*"],
"exclude": ["**/*.test.ts"]
Expand Down

0 comments on commit 3920908

Please sign in to comment.