UNPKG

@zero-scripts/webpack-config

Version:
67 lines 3.12 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.WebpackConfigOptions = void 0; const fs_1 = require("fs"); const core_1 = require("@zero-scripts/core"); const resolvePaths_1 = require("./resolvePaths"); class WebpackConfigOptions extends core_1.AbstractOptionsContainer { constructor() { super(...arguments); this.paths = { root: '', src: 'src', build: 'build', indexJs: 'src/index', indexHtml: 'public/index.html', public: 'public', publicPath: process.env.PUBLIC_PATH || '', tsConfig: 'tsconfig.json' }; this.useSourceMap = true; this.additionalEntry = []; this.moduleFileExtensions = ['.json', '.js', '.mjs']; this.jsFileExtensions = ['js', 'mjs']; this.isDev = false; this.useTypescript = false; } } __decorate([ core_1.Option(({ defaultValue, externalValue }) => (Object.assign(Object.assign({}, defaultValue), externalValue)), [], (value, { jsFileExtensions, isDev }) => resolvePaths_1.resolvePaths(value, jsFileExtensions, isDev)) ], WebpackConfigOptions.prototype, "paths", void 0); __decorate([ core_1.Option() ], WebpackConfigOptions.prototype, "useSourceMap", void 0); __decorate([ core_1.Option(({ externalValue, defaultValue }) => [ ...defaultValue, ...(externalValue ? externalValue : []) ]) ], WebpackConfigOptions.prototype, "additionalEntry", void 0); __decorate([ core_1.Option(({ externalValue, defaultValue, dependencies }) => [ ...defaultValue, ...(dependencies.useTypescript ? ['.ts', '.tsx'] : []), ...(externalValue ? externalValue : []) ], ['useTypescript']) ], WebpackConfigOptions.prototype, "moduleFileExtensions", void 0); __decorate([ core_1.Option(({ externalValue, defaultValue, dependencies }) => [ ...defaultValue, ...(dependencies.useTypescript ? ['ts', 'tsx'] : []), ...(externalValue ? externalValue : []) ], ['useTypescript']) ], WebpackConfigOptions.prototype, "jsFileExtensions", void 0); __decorate([ core_1.Option() ], WebpackConfigOptions.prototype, "isDev", void 0); __decorate([ core_1.Option(({ externalValue, dependencies }) => externalValue ? externalValue : fs_1.existsSync(dependencies.paths.tsConfig), ['paths']) ], WebpackConfigOptions.prototype, "useTypescript", void 0); exports.WebpackConfigOptions = WebpackConfigOptions; //# sourceMappingURL=WebpackConfigOptions.js.map