forked from Azure/api-management-developer-portal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.staticData.js
34 lines (28 loc) · 1.25 KB
/
webpack.staticData.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
const {staticDataEnvironment} = require("./environmentConstants")
const webpack = require("webpack");
const publisherConfig = require("./webpack.publisher");
const CopyWebpackPlugin = require("copy-webpack-plugin");
let staticData = publisherConfig;
staticData.publisherConfig.mode = "none";
staticData.publisherConfig.plugins.push(new webpack.DefinePlugin({
"process.env.NODE_ENV": JSON.stringify(staticDataEnvironment)
}));
staticData.publisherConfig.plugins.push(new CopyWebpackPlugin({
patterns: [
{ from: `./templates/default.json`, to: "editors/templates/default.json" },
{ from: `./tests/mocks/defaultStaticData.json`, to: "tests/mocks/defaultStaticData.json" }
]
}));
staticData.publisherRuntimeConfig.mode = "none";
staticData.publisherRuntimeConfig.plugins.push(new webpack.DefinePlugin({
"process.env.NODE_ENV": JSON.stringify(staticDataEnvironment)
}));
staticData.publisherRuntimeConfig.plugins.push(new CopyWebpackPlugin({
patterns: [
{ from: `./templates/default.json`, to: "editors/templates/default.json" },
{ from: `./tests/mocks/defaultStaticData.json`, to: "tests/mocks/defaultStaticData.json" }
]
}));
module.exports = {
default: [staticData.publisherConfig, staticData.publisherRuntimeConfig]
}