GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — nitro/webpack.config.js at master · nitrotasks/nitro
This repository was archived by the owner on Jan 22, 2021. It is now read-only.
Expand file tree/ Copy pathwebpack.config.jsMore file actions 189 lines (184 loc) · 4.3 KB / Copy pathwebpack.config.jsFile metadata and controls189 lines (184 loc) · 4.3 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 const path = require('path') const baseDirectory = __dirname const buildPath = path.resolve(baseDirectory, './dist') const BundleAnalyzerPlugin = require('webpack-bundle-analyzer') .BundleAnalyzerPlugin const webpack = require('webpack') const OfflinePlugin = require('offline-plugin') const HtmlWebpackPlugin = require('html-webpack-plugin') const MiniCssExtractPlugin = require('mini-css-extract-plugin') const devMode = process.env.NODE_ENV !== 'production' const AssetsWebpackPlugin = require('assets-webpack-plugin') const commonConfig = { context: baseDirectory, entry: { app: ['./config/index.js', './nitro.ui/index.js'] }, devtool: 'cheap-module-eval-source-map', module: { rules: [ { test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/, use: [ { loader: 'file-loader', options: { outputPath: 'generated/assets/' } } ] } ] }, devServer: { contentBase: path.join(__dirname, 'dist'), historyApiFallback: true, host: '0.0.0.0', disableHostCheck: true, proxy: { '/a': { target: 'http://localhost:8040', pathRewrite: { '^/a': '' } }, '/a/ws': { target: 'ws://localhost:8040', pathRewrite: { '^/a': '' }, ws: true } } }, plugins: [ new MiniCssExtractPlugin({ filename: 'generated/[name].[contenthash].css', chunkFilename: 'generated/[id].[contenthash].css' }) ], optimization: { splitChunks: { cacheGroups: { commons: { test: /[\\/]node_modules[\\/]/, name: 'vendor', chunks: 'all' } } } } } if (process.env.NODE_ENV === 'production') { commonConfig.devtool = 'nosources-source-map' } const legacyConfig = { ...commonConfig, name: 'client-legacy', output: { filename: 'generated/[name].[hash].js', chunkFilename: 'generated/[name].[id].[chunkhash].js', path: buildPath, publicPath: '/' }, module: { rules: [ { test: /\.(js|jsx)$/, use: { loader: 'babel-loader', options: { envName: 'legacy' // Points to env.legacy in babel.config.js } } }, { test: /\.css$/, use: 'null-loader' }, ...commonConfig.module.rules ] }, plugins: [ ...commonConfig.plugins, new webpack.DefinePlugin({ 'process.env': { NODE_ENV: JSON.stringify(process.env.NODE_ENV), BUILD_ENV: JSON.stringify('legacy') } }), new AssetsWebpackPlugin({ filename: 'assets.legacy.json', fileTypes: ['js', 'mjs'] }) ] } const modernConfig = { ...commonConfig, name: 'client-modern', output: { filename: 'generated/[name].[hash].mjs.js', chunkFilename: 'generated/[name].[id].[chunkhash].mjs.js', path: buildPath, publicPath: '/' }, module: { rules: [ { test: /\.(mjs|js|jsx)$/, use: { loader: 'babel-loader', options: { envName: 'modern' // Points to env.modern in babel.config.js } } }, { test: /\.css$/, use: [ devMode ? 'style-loader' : MiniCssExtractPlugin.loader, 'css-loader' ] }, ...commonConfig.module.rules ] }, plugins: [ ...commonConfig.plugins, new webpack.DefinePlugin({ 'process.env': { NODE_ENV: JSON.stringify(process.env.NODE_ENV), BUILD_ENV: JSON.stringify('modern') } }), new HtmlWebpackPlugin({ template: 'nitro.ui/index.html', title: 'Nitro', chunks: devMode ? undefined : [] }), new AssetsWebpackPlugin({ filename: 'assets.json', fileTypes: ['js', 'mjs'] }) ] } if (process.env.NODE_ENV === 'production') { // doesn't support mjs legacyConfig.plugins.push( new BundleAnalyzerPlugin({ analyzerMode: 'static', openAnalyzer: false }) ) modernConfig.plugins.push( new OfflinePlugin({ appShell: '/', externals: [ '/img/favicon/favicon-48x48.png', '/img/favicon/favicon-32x32.png', '/img/favicon/favicon-16x16.png' ], AppCache: false, ServiceWorker: { minify: false } }) ) } module.exports = [legacyConfig, modernConfig] |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |