-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
50 lines (46 loc) · 1.23 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
const path = require("path");
const webpack = require("webpack");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const dotenv = require("dotenv");
dotenv.config();
module.exports = {
mode: process.env.NODE_ENV,
entry: {
main: ["./src/app.js"]
},
output: {
path: path.resolve(__dirname, "./public"),
publicPath: path.resolve(__dirname, "./public"),
filename: `[name].bundle.js`
},
resolve: {
extensions: [".jsx", ".js"],
modules: ["node_modules"]
},
module: {
rules: [
{
test: /\.css$/,
include: path.resolve(__dirname, "node_modules"),
use: ["style-loader", "css-loader"]
},
{
test: /\.(js|jsx)$/, // files ending with .js
exclude: /node_modules/, // exclude the node_modules directory
loader: "babel-loader" // use this (babel-core) loader
}
]
},
plugins: [
// Create the dist HTML file with variables defined in src/config
new HtmlWebpackPlugin({ title: "App Bridge Tutorial" }),
// Sets variables to be usable in the JS
new webpack.DefinePlugin({
SHOPIFY_API_KEY: JSON.stringify(process.env.SHOPIFY_API_KEY)
})
],
externals: {
polaris: "@shopify/polaris"
},
devtool: "source-map"
};