-
Notifications
You must be signed in to change notification settings - Fork 7
/
webpack.config.dev.js
53 lines (51 loc) · 1.36 KB
/
webpack.config.dev.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const webpack = require("webpack");
if (process.env.NODE_ENV !== "production") {
require("dotenv").config();
console.log("Loading CLIENT_ID: ", process.env.CLIENT_ID);
}
module.exports = {
mode: "development",
entry: "./demo/index.tsx",
devtool: "inline-source-map",
module: {
rules: [
{
test: /\.tsx?$/,
use: "ts-loader",
exclude: /node_modules/,
},
{
test: /\.(png|jpe?g|gif)$/i,
loader: 'file-loader',
options: {
name: '[path][name].[ext]',
},
}
],
},
resolve: {
extensions: [".tsx", ".ts", ".js", ".png"],
},
output: {
crossOriginLoading: "anonymous",
},
devServer: {
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': '*',
},
port: 3000,
},
plugins: [
new HtmlWebpackPlugin({
title: "React Google OAuth2.0 Demo",
filename: "index.html",
template: "./demo/index.html"
}),
new webpack.DefinePlugin({
"process.env.CLIENT_ID": JSON.stringify(process.env.CLIENT_ID),
}),
],
};