github.com/vcilabs/webrpc@v0.5.2-0.20201116131534-162e27b1b33b/_examples/hello-webrpc-with-goschema-ts/webapp/webpack.config.js (about) 1 const path = require('path') 2 const fs = require('fs') 3 const webpack = require('webpack') 4 const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin') 5 const HtmlWebpackPlugin = require('html-webpack-plugin') 6 7 const main = [ 8 'webpack-dev-server/client?http://0.0.0.0:4444', 9 'webpack/hot/only-dev-server', 10 'whatwg-fetch', 11 './src/index.ts' 12 ] 13 14 module.exports = { 15 context: process.cwd(), // to automatically find tsconfig.json 16 entry: { 17 main: main 18 }, 19 optimization: { 20 namedModules: true 21 }, 22 plugins: [ 23 new webpack.HotModuleReplacementPlugin(), 24 new ForkTsCheckerWebpackPlugin({ 25 tslint: true, 26 checkSyntacticErrors: true, 27 watch: ['./src'] // optional but improves performance (fewer stat calls) 28 }), 29 new webpack.DefinePlugin({ 30 'process.env.NODE_ENV': JSON.stringify('development'), 31 }), 32 new HtmlWebpackPlugin({ 33 inject: true, 34 template: 'src/index.html' 35 }) 36 ], 37 module: { 38 rules: [{ 39 test: /.tsx?$/, 40 use: [{ 41 loader: 'ts-loader', 42 options: { 43 transpileOnly: true 44 } 45 }], 46 exclude: path.resolve(process.cwd(), 'node_modules'), 47 include: [ 48 path.resolve(process.cwd(), 'src'), 49 ] 50 }, { 51 test: /\.(jpe?g|png|gif|svg)$/i, 52 use: [{ 53 loader: 'url-loader', 54 options: { 55 limit: 8192000 56 } 57 }] 58 }] 59 }, 60 resolve: { 61 extensions: ['.tsx', '.ts', '.js', '.png', '.jpg'] 62 }, 63 devtool: 'inline-source-map', 64 devServer: { 65 host: '0.0.0.0', 66 port: 4444, 67 open: false, 68 hot: true, 69 historyApiFallback: true, 70 stats: 'errors-only', 71 disableHostCheck: true, 72 contentBase: path.resolve(process.cwd(), 'src/public'), 73 publicPath: '/' 74 } 75 }