-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
32 lines (31 loc) · 921 Bytes
/
webpack.config.js
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
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { join } = require('path');
const { EnvironmentPlugin } = require('webpack');
module.exports = {
mode: process.env.NODE_ENV,
devtool: 'source-map',
entry: './src/index.tsx',
resolve: { extensions: ['.js', '.jsx', '.ts', '.tsx'] },
module: {
rules: [
{ test: /\.tsx?$/, use: ['babel-loader', 'ts-loader'] },
{ test: /\.svg$/, use: ['@svgr/webpack'] },
],
},
plugins: [
new HtmlWebpackPlugin({ template: 'web/index.html' }),
new EnvironmentPlugin(['GRAPHQL_URL', 'IMAGE_URL', 'MAP_URL', 'MAP_KEY']),
],
optimization: { minimize: process.env.NODE_ENV === 'production' },
output: {
path: join(__dirname, 'dist'),
filename: 'scripts/[contenthash].js',
publicPath: '/',
},
devServer: {
stats: 'errors-warnings',
contentBase: 'web',
compress: true,
historyApiFallback: true,
},
};