'use strict' // MIT License // Copyright (c) 2021 Bootcamp-Project contributors // 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. import _ from 'lodash' import { default as path } from 'node:path' import Webpack from 'webpack' import WebpackDev from 'webpack-dev-server' export const WebpackConfig: Webpack.Configuration | WebpackDev.Configuration = { mode: 'production', target: 'browserslist', devtool: 'source-map', performance: { hints: false, maxEntrypointSize: 512_000, maxAssetSize: 512_000 }, resolve: { modules: [path.resolve('src'), path.resolve('node_modules')], extensions: ['.js'], fallback: { util: false, path: false, fs: false // assert: require.resolve('assert'), // buffer: require.resolve('buffer'), // console: require.resolve('console-browserify'), // constants: require.resolve('constants-browserify'), // crypto: require.resolve('crypto-browserify'), // domain: require.resolve('domain-browser'), // events: require.resolve('events'), // http: require.resolve('stream-http'), // https: require.resolve('https-browserify'), // os: require.resolve('os-browserify/browser'), // path: require.resolve('path-browserify'), // punycode: require.resolve('punycode'), // process: require.resolve('process/browser'), // querystring: require.resolve('querystring-es3'), // stream: require.resolve('stream-browserify'), // string_decoder: require.resolve('string_decoder'), // sys: require.resolve('util'), // timers: require.resolve('timers-browserify'), // tty: require.resolve('tty-browserify'), // url: require.resolve('url'), // util: require.resolve('util'), // vm: require.resolve('vm-browserify'), // zlib: require.resolve('browserify-zlib'), } } } export const WebpackDevelopmentConfig: Webpack.Configuration | WebpackDev.Configuration = _.merge(WebpackConfig, { mode: 'development', devtool: 'eval-source-map', performance: { hints: undefined, maxEntrypointSize: 512_000, maxAssetSize: 512_000 }, devServer: { historyApiFallback: true, compress: true, port: 3000 } })