-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
86 lines (85 loc) · 2.03 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
const path = require("path");
const webpack = require("webpack");
module.exports = {
entry: [
"./public-path.js",
"./packages/carbon-addons-entrypoint/src/index.js",
],
mode: "development",
module: {
rules: [
{
test: /\.scss$/,
use: [
"style-loader",
"css-loader",
{
loader: "sass-loader",
options: {
sassOptions: {
includePaths: ["node_modules"],
},
},
},
],
include: [
path.resolve(__dirname, "./packages/carbon-addons-devenv/src/scss"),
path.resolve(__dirname, "./packages/custom-carbon-addons/src/scss"),
],
},
{
test: /\.(js|jsx)$/,
loader: "babel-loader",
options: { presets: ["@babel/env"] },
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"],
},
{
test: /\.(gif|png|jpe?g|svg)$/i,
loader: "file-loader",
},
{
test: /\.(png|woff|woff2|eot|ttf|svg)$/,
loader: "url-loader",
options: {
limit: 100000,
},
},
],
},
plugins: [
new webpack.EnvironmentPlugin([
"RELATIVE_PATH_TO_BUNDLE",
"GRAPHQL_SERVER_URL",
"CUSTOM_COMPONENT_NAME",
"CSRF_TOKEN_REQUEST_HEADER",
"CSRF_TOKEN_ENPOINT",
]),
],
resolve: {
extensions: ["*", ".js", ".jsx"],
alias: {
devenv_pkg: path.resolve("./packages/carbon-addons-devenv"),
custom_pkg: path.resolve("./packages/custom-carbon-addons"),
},
},
output: {
path: path.resolve(__dirname, "dist/"),
library: "spmcustom",
publicPath: "/dist/",
filename: "spm-custom-carbon-addons-[name].bundle.js",
chunkFilename: "spm-custom-carbon-addons-[name].chunk.js",
},
watchOptions: {
poll: 400,
ignored: "**/node_modules",
},
devServer: {
contentBase: path.join(__dirname, "public/"),
port: 3000,
publicPath: "http://localhost:3000/dist/",
hotOnly: false,
},
};