-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbackpack.config.js
46 lines (40 loc) · 1.02 KB
/
backpack.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
const ExtraWatchWebpackPlugin = require("extra-watch-webpack-plugin");
const Dotenv = require("dotenv-webpack");
const CopyPlugin = require("copy-webpack-plugin");
const path = require("path");
const NODE_ENV = process.env.NODE_ENV;
const env_path = {
development: "./.development.env",
test: "./.test.env",
production: "./.production.env"
};
module.exports = {
webpack: (config, options, webpack) => {
config.plugins.push(
new ExtraWatchWebpackPlugin({
files: ["src/**/*.graphql"]
})
);
config.plugins.push(
new Dotenv({
path: env_path[NODE_ENV]
})
);
config.plugins.push(
new CopyPlugin([{ from: "src/services/emails", to: "emails" }])
);
config.resolve.alias = {
src: path.join(__dirname, "./src")
};
config.module.rules.push({
exclude: /node_modules/,
test: /\.graphql$/,
use: [{ loader: "graphql-import-loader" }]
});
config.node = {
...config.node,
__dirname: true
};
return config;
}
};