forked from jasonappah/js-confetti
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.site.ts
48 lines (43 loc) · 1.13 KB
/
webpack.config.site.ts
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
/* eslint-env node */
import { Configuration } from 'webpack'
import path from 'path'
import HtmlWebpackPlugin from 'html-webpack-plugin'
import CopyWebpackPlugin from 'copy-webpack-plugin'
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'
const isProd = process.env.NODE_ENV === 'production'
const config: Configuration = {
mode: isProd ? 'production' : 'development',
entry: './site/index.tsx',
output: {
filename: '[name][contenthash].js',
path: path.resolve(__dirname, 'site_dist'),
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'babel-loader',
// use: ['babel-loader', '@babel/plugin-transform-react-jsx'],
exclude: /node_modules/,
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
plugins: [
new HtmlWebpackPlugin({ template: './assets/index.html' }),
new ForkTsCheckerWebpackPlugin(),
new CopyWebpackPlugin({
patterns: [{ from: 'static' }],
})
],
}
if (!isProd) {
config.devServer = {
contentBase: path.join(__dirname, 'site_dist'),
compress: true,
port: 9000
}
}
module.exports = config