1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/packages/infrastructure/webpack/src/node-config.js
Janne Savolainen c09c7125e5
Add package for sharing webpack configurations for upcoming Features (#7199)
* Add package for shared webpack configurations for Lens applications, Features and libraries

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Remove duplication from gitignores

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

---------

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
2023-02-22 12:28:07 +02:00

69 lines
1.1 KiB
JavaScript

const nodeExternals = require("webpack-node-externals");
const path = require("path");
const buildDirectory = path.resolve(process.cwd(), "dist");
module.exports = {
entry: { index: "./index.ts" },
target: "node",
mode: "production",
performance: {
maxEntrypointSize: 100000,
hints: "error",
},
resolve: {
extensions: [".ts", ".tsx"],
},
output: {
path: buildDirectory,
filename: (pathData) =>
pathData.chunk.name === "index"
? "index.js"
: `${pathData.chunk.name}/index.js`,
libraryTarget: "commonjs2",
},
externals: [
nodeExternals({ modulesFromFile: true }),
nodeExternals({
modulesDir: path.resolve(
__dirname,
"..",
"..",
"..",
"..",
"node_modules"
),
}),
],
externalsPresets: { node: true },
node: {
__dirname: true,
__filename: true,
},
module: {
rules: [
{
test: /\.ts(x)?$/,
loader: "ts-loader",
options: {
compilerOptions: {
declaration: true,
declarationDir: "./dist",
},
},
},
],
},
};