-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
66 lines (63 loc) · 1.67 KB
/
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
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
require("dotenv").config();
const path = require("path");
const webpack = require("webpack");
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");
// const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
module.exports = {
context: __dirname,
entry: "./frontend/robins_jacket.jsx",
output: {
path: path.resolve(__dirname, "app", "assets", "javascripts"),
filename: "bundle.js",
},
resolve: {
extensions: [".js", ".jsx", ".ts", ".tsx", "*"],
fallback: {
"readable-stream": require.resolve("readable-stream"),
},
},
module: {
rules: [
{
test: /\.[jt]sx?$/,
exclude: /(node_modules)/,
use: {
loader: "babel-loader",
options: {
presets: ["@babel/preset-env", "@babel/preset-react"], // "@babel/preset-typescript"
},
},
},
{
test: /\.(sc|c)ss$/,
use: [
{
loader: 'sass-loader',
options: {
implementation: require('sass')
}
},
]
},
],
},
stats: {
modules: true,
errorDetails: true,
children: true
},
plugins: [
new NodePolyfillPlugin(),
new webpack.DefinePlugin({
"process.browser": JSON.stringify(true),
"process.env": {
RAPID_API_KEY: JSON.stringify(process.env.RAPID_API_KEY),
RAPID_API_HOST: JSON.stringify(process.env.RAPID_API_HOST),
aws_access_key_id: JSON.stringify(process.env.aws_access_key_id),
aws_secret_access_key: JSON.stringify(process.env.aws_secret_access_key),
},
}),
// new BundleAnalyzerPlugin()
],
devtool: "eval-source-map",
};