webpack-typescript-builder
Version:
Webpack config builder for typescript, styles (css and sass), fonts and images.
44 lines (43 loc) • 1.58 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fork_ts_checker_webpack_plugin_1 = __importDefault(require("fork-ts-checker-webpack-plugin"));
const tsconfig_paths_webpack_plugin_1 = __importDefault(require("tsconfig-paths-webpack-plugin"));
const rules_1 = require("./rules");
function createServerConfig(tsConfigLocation, entry, outputPath, isProduction) {
return {
devtool: isProduction ? "source-map" : "cheap-module-eval-source-map",
entry,
mode: isProduction ? "production" : "development",
module: { rules: rules_1.serverRules },
name: "server",
optimization: {
minimize: false,
namedChunks: true,
namedModules: true,
},
output: {
filename: "[name].js",
libraryTarget: "commonjs2",
path: outputPath,
pathinfo: false,
publicPath: "/",
},
plugins: [
new fork_ts_checker_webpack_plugin_1.default({
tsconfig: tsConfigLocation,
tslint: true,
}),
],
resolve: {
alias: {},
extensions: [".js", ".jsx", ".ts", ".tsx"],
plugins: [new tsconfig_paths_webpack_plugin_1.default({ configFile: tsConfigLocation })],
},
stats: false,
target: "node",
};
}
exports.createServerConfig = createServerConfig;