Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build!: don't vendor dependencies #225

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@
"@commitlint/cli": "^19.2.1",
"@commitlint/config-conventional": "^19.1.0",
"@jest/types": "^29.6.3",
"@rollup/plugin-commonjs": "^26.0.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-typescript": "^11.1.6",
"@types/events": "^3.0.0",
"@types/jest": "^29.5.12",
Expand Down
127 changes: 0 additions & 127 deletions pnpm-lock.yaml

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

25 changes: 16 additions & 9 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import typescript from '@rollup/plugin-typescript';
import {nodeResolve} from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import {join} from 'path';
import pkg from './package.json';

const srcDir = join(__dirname, 'src');
const outDir = 'output';
Expand Down Expand Up @@ -42,13 +41,21 @@ function buildConfig(format) {
return `[name].${ext}`;
},
},
external: [
// All dependencies are external (aka imported from node_modules)
...Object.keys(pkg.dependencies),
],
onwarn(warning, warn) {
// Throw an error on unresolved dependencies (not listed in package json)
if (warning.code === 'UNRESOLVED_IMPORT')
throw new Error(`${warning.message}.
Make sure this dependency is listed in the package.json
`);

// Use default for everything else
warn(warning);
},
plugins: [
// i dont want to include the node modules
// but it's causing issues
nodeResolve({
preferBuiltins: false,
}),
commonjs(),
typescript({
declaration: true,
outDir: outDir,
Expand All @@ -57,4 +64,4 @@ function buildConfig(format) {
};
}

export default [buildConfig('cjs'), buildConfig('esm')];
export default [buildConfig('cjs'), buildConfig('esm')];