LeDDGroup/scroll-utility

View on GitHub
webpack.config.ts

Summary

Maintainability
A
1 hr
Test Coverage
import HtmlWebpackPlugin from "html-webpack-plugin"
import { Configuration } from "webpack"
import { resolve } from "path"
 
Function `config` has 27 lines of code (exceeds 25 allowed). Consider refactoring.
function config(env: { NODE_ENV?: string } = {}): Configuration {
const production = env.NODE_ENV !== "development"
return {
mode: production ? "production" : "development",
entry: "./src/index.ts",
output: {
filename: "scroll-utility.js",
path: resolve(__dirname, "dist"),
library: "ScrollUtility",
libraryTarget: "umd",
umdNamedDefine: true,
},
module: {
rules: [
{
test: /\.ts$/,
loader: "ts-loader",
options: {
configFile: "tsconfig-build.json",
},
},
],
},
resolve: {
extensions: [".ts", ".tsx", ".js"],
},
plugins: production ? [] : [new HtmlWebpackPlugin({ template: "playground/index.html" })],
}
}
 
export default config