Skip to content

Commit

Permalink
drop webpack-node-externals dependency (#422)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov authored Sep 29, 2024
1 parent 59c89bd commit 97716e3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 27 deletions.
23 changes: 1 addition & 22 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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
"@types/node": "22.7.4",
"@types/react": "18.3.10",
"@types/react-dom": "18.3.0",
"@types/webpack-node-externals": "3.0.4",
"@typescript-eslint/eslint-plugin": "8.7.0",
"@typescript-eslint/parser": "8.7.0",
"cspell": "8.14.4",
Expand Down Expand Up @@ -87,7 +86,6 @@
"typescript": "5.5.4",
"webpack": "5.95.0",
"webpack-cli": "5.1.4",
"webpack-dev-server": "5.1.0",
"webpack-node-externals": "3.0.0"
"webpack-dev-server": "5.1.0"
}
}
11 changes: 9 additions & 2 deletions webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as path from 'node:path';

import * as MiniCssExtractPlugin from 'mini-css-extract-plugin';
import * as webpack from 'webpack';
import * as NodeExternals from 'webpack-node-externals';
import { ExternalItemFunctionData } from 'webpack';

// eslint-disable-next-line @typescript-eslint/no-require-imports
const packageJSON = require('./package.json');
Expand Down Expand Up @@ -84,7 +84,14 @@ const config: Array<webpack.Configuration> = [
{
...baseConfig,
entry: './src/index.ts',
externals: NodeExternals(),
externalsType: 'commonjs',
externals: ({ request }: ExternalItemFunctionData) =>
Promise.resolve(
[
...Object.keys(packageJSON.peerDependencies),
...Object.keys(packageJSON.dependencies),
].some((pkg) => request === pkg || request?.startsWith(pkg + '/')),
),
output: {
...baseConfig.output,
filename: 'voyager.lib.js',
Expand Down

0 comments on commit 97716e3

Please sign in to comment.