Commit 301574b8 authored by 郭志伟's avatar 郭志伟

fix: apollo测试

parent 3a5f9a34
'use strict'; 'use strict';
const path = require('path'); const path = require('path');
const fs = require('fs');
const SentryPlugin = require("webpack-sentry-plugin"); const SentryPlugin = require("webpack-sentry-plugin");
const resolve = filepath => path.resolve(__dirname, filepath); const resolve = filepath => path.resolve(__dirname, filepath);
const SentryConfig = require("./app/web/.sentryclirc.ts"); const SentryConfig = require("./app/web/.sentryclirc.ts");
const apolloSource = require('./config/apollo.json'); const apolloSource = require('./config/apollo.json');
let apollo = {};
if (process.env.NODE_ENV !== 'development') {
apollo = { ...apolloSource.api, ...apolloSource.qiniu };
}
let { name } = require('./package'); let { name } = require('./package');
name = name.replace(/-/g, ''); name = name.replace(/-/g, '');
async function getApolloCfg() {
if (process.env.NODE_ENV === 'development') return;
await apollo.load({
appId: 'quantum-blocks',
configPath: path.resolve(__dirname, '../config'),
});
const cfg = require("./config/apollo.json");
return { ...cfg.api, ...cfg.qiniu }
}
module.exports = { module.exports = {
entry: { entry: {
'login': 'app/web/page/login/index.vue', 'login': 'app/web/page/login/index.vue',
...@@ -79,7 +86,7 @@ module.exports = { ...@@ -79,7 +86,7 @@ module.exports = {
'process.env': { 'process.env': {
SENTRY_ENV: JSON.stringify(process.env.SENTRY_ENV) SENTRY_ENV: JSON.stringify(process.env.SENTRY_ENV)
}, },
'window.apollo': JSON.stringify(apollo) 'window.apollo': JSON.stringify(getApolloCfg())
} }
} }
], ],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment