/* * MIT License * * Copyright (c) 2018 Choko (choko@curioswitch.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* eslint-disable import/first */ process.env.NODE_ENV = 'development'; import fs from 'fs'; import path from 'path'; import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'; import HtmlWebpackPlugin from 'html-webpack-plugin'; import { Configuration, DefinePlugin, HotModuleReplacementPlugin, } from 'webpack'; import configureBase from './base'; const APP_CONFIG_PATH = ['.ts', '.js'] .map((ext) => path.resolve(process.cwd(), `src/app${ext}`)) .find((p) => fs.existsSync(p)); const plugins = [ new DefinePlugin({ 'process.env': { APP_CONFIG_PATH: JSON.stringify(APP_CONFIG_PATH), NODE_ENV: JSON.stringify('development'), }, WEBPACK_PRERENDERING: false, }), new ForkTsCheckerWebpackPlugin({ checkSyntacticErrors: true }), new HtmlWebpackPlugin({ inject: true, template: 'src/index.html', chunksSortMode: 'none', }), new HotModuleReplacementPlugin(), ]; const configuration: Configuration = configureBase({ plugins, mode: 'development', babelPlugins: [], // Don't use hashes in dev mode for better performance output: { filename: '[name].js', chunkFilename: '[name].chunk.js', pathinfo: false, }, devtool: 'cheap-module-eval-source-map', optimization: { removeAvailableModules: false, removeEmptyChunks: false, splitChunks: false, }, }); export default configuration;